Source

filesnake / filesnake / gui / preferences.py

Full commit
'''
Preferences dialog
'''
from ..pygtkhelpers.delegates import ToplevelView
from ..settings import config, store_config, dest_dir

class PreferencesDialog(ToplevelView):
    
    builder_file = "preferences.glade"
    def create_ui(self):
        self.selectfile.set_filename(dest_dir())
        
    def on_widget__delete_event(self, *a):
        self.hide()
        return True
    
    def on_cancel__activate(self, act):
        self.hide()
        
    def on_apply__activate(self, fc):
        '''
        Idea:
        - darken the button when clicked and activate it when it's dirten?
        '''
        filename = self.selectfile.get_filename()
        config.set("path", "dest_dir", filename)
        store_config()
        
def test():
    PreferencesDialog().show_and_run()
if __name__ == '__main__':
    test()