Home Download Buy Blog Forum Support

[Beta] ThemeChanger [ideas needed]

[Beta] ThemeChanger [ideas needed]

Postby DanielV on Mon Oct 22, 2012 8:15 pm

[Beta] ThemeChanger for Sublime Text 2

Introduction:
I always used to switch my color scheme depending on the amount of sunlight, because looking at a dark screen in a light environment or vice versa gives me eye strains. When developing I'm always focussed on the project and I always found myself changing the color scheme way to late when I was already feeling my eyes a little. So I made a simple bash script that switched my user preferences around 7:30 and 19:30, this didn't work so well because every times I changed some settings. I forgot to do it in the backup files causing me to lose my settings. So I started developing this plugin. I think that every developer that uses Sublime Text 2 for most of their day should try this out to see the difference.

Repository:
Beta: Github

Want to help?
  • I'm currently looking for ideas to improve the plugin. Leave a comment with your suggestion.
  • The plugin is still in beta and since the plugin is quite a background plugin I need beta testers to find bugs and performance issues
  • If you would like to contribute to the plugin by developing, go over to the github page. I'll always accept great pulls!

Status
Version: Beta 0.2

Bugs:
  • One report of the plugin deleting settings
Changelog:
0.2
  • Rebuild the way settings are loaded, causing better performance. (Thanks to facelessuser)
  • Changed the timeformat to (H:i or H:i:s) for a better user experience (Thanks to facelessuser as well)
  • Solved issues depending on client

0.1.2
  • Big bugfix, used to reset preferences
  • README.md fix - Duplication of lines due to being inexperienced with git

0.1.1
  • Now checks what theme is should be on boot
  • Minor bugfixes
  • Updated README

0.1:
  • First working version
  • Changed status to beta
Last edited by DanielV on Wed Oct 24, 2012 9:37 pm, edited 5 times in total.
DanielV
 
Posts: 11
Joined: Sat Oct 20, 2012 8:38 pm

Re: [Beta] ThemeChanger [ideas needed]

Postby facelessuser on Tue Oct 23, 2012 3:16 pm

I haven't used the plugin because I have written my own, but I want to encourage someone to release an officially supported one (I have too many plugins right now as is and am not looking to release another one right now).

I did want to give some suggestions that may or may not help you. Feel free to disregard any of my suggestions :).

1. I can't really see people needing per second resolution for theme changing. Probably hour and minute is enough.
2. Also, I think it would be nice if you could just allow the time to be configured in a simple manner like this:
        {
"theme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme",
"time": "08:30"
},
{
"theme": "Packages/User/Color Scheme/Tomorrow-Night-Eighties.tmTheme",
"time": "17:30"
}


Even though the theme file is not defining seconds, it is easy to convert this to a time object with in python, and even convert it to just seconds (which is what I do as well). Here is an example:
 1 from datetime import datetime, timedelta

...

12 def total_seconds(t):
13 return (t.microseconds + (t.seconds + t.days * 24 * 3600) * 10 ** 6) / 10 ** 6

...

22 def translate_time(t):
23 # Translate a string from format "H:M" into seconds
24 tm = time.strptime(t + ":00", '%H:%M:%S')
25 return total_seconds(timedelta(hours=tm.tm_hour, minutes=tm.tm_min, seconds=tm.tm_sec))


3. Also, I see you are having a settings file reload issue. This is not a bug in ST2. There is a simple solution provided in the API. You can use add_on_change to define an function to run when the settings file changes. You just give it a pointer to the function or a lambda.
 8 # Init the settings object
9 SETTINGS = sublime.load_settings('ThemeScheduler.sublime-settings')

...

153 # Reset the theme scheduler object if the settings file has changed
154 SETTINGS.add_on_change('reload', ThemeScheduler.init)


Maybe these suggestions will help, anyways, good luck with your plugin.
facelessuser
 
Posts: 1574
Joined: Tue Apr 05, 2011 7:38 pm

Re: [Beta] ThemeChanger [ideas needed]

Postby DanielV on Tue Oct 23, 2012 3:55 pm

Thanks for the suggestions.
I'm quite new to python and the ST2 API so at least thanks for suggestion 3, this is a way more efficient way than I'm using right now!

And to combine suggestion 1 and 2. I like to give people full control over the time so I'll include seconds, but you have a valid point that using the way you format time is more user friendly.So I'll make it that you can decide whether you want to define it with (08:30:15) or without (08:30) seconds.

I'm quite busy at the moment but I'll commit the changes to the plugin either today or tomorrow :D

Thanks again for these great suggestions!
DanielV
 
Posts: 11
Joined: Sat Oct 20, 2012 8:38 pm

Re: [Beta] ThemeChanger [ideas needed]

Postby DanielV on Wed Oct 24, 2012 9:35 pm

Update!
Version Beta 0.2

What's changed?
  • Rebuild the way settings are loaded, causing better performance. (Thanks to facelessuser)
  • Changed the timeformat to (H:i or H:i:s) for a better user experience (Thanks to facelessuser as well)
  • Solved issues depending on client
DanielV
 
Posts: 11
Joined: Sat Oct 20, 2012 8:38 pm


Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 8 guests