~ubuntu-branches/ubuntu/trusty/autokey/trusty-proposed

« back to all changes in this revision

Viewing changes to src/lib/gtkui/configwindow.py

  • Committer: Package Import Robot
  • Author(s): Andrew Starr-Bochicchio, Jakub Wilk, Andrew Starr-Bochicchio
  • Date: 2014-01-28 22:10:47 UTC
  • mfrom: (1.4.5)
  • Revision ID: package-import@ubuntu.com-20140128221047-4ag02iz2c6ge1ns4
Tags: 0.90.4-1
* Team upload.

[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Andrew Starr-Bochicchio ]
* New upstream release (Closes: #717948).
* Acknowledge my own NMU.
* Fix debian/watch file to find new versions. 
* Fix chmod call in debian/rules for new path.
* Bump Standards-Version to 3.9.5, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
725
725
    def __init__(self, app):
726
726
        self.app = app
727
727
        self.cutCopiedItems = []
 
728
        self.__warnedOfChanges = False
728
729
        
729
730
        builder = get_ui("mainwindow.xml")
730
731
        self.ui = builder.get_object("mainwindow")
848
849
        self.uiManager.get_action("/MenuBar/File/revert").set_sensitive(dirty)
849
850
        
850
851
    def config_modified(self):
851
 
        Gdk.threads_enter()
852
 
        msg = _("Changes made in other programs will not be displayed until you\
853
 
 close and reopen the AutoKey window.")
854
 
        dlg = Gtk.MessageDialog(self.ui, type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.OK,
855
 
                               message_format= _("Configuration has been changed on disk."))
856
 
        dlg.format_secondary_text(msg)
857
 
        
858
 
        #if self.dirty:
859
 
        #    checkButton = Gtk.CheckButton(_("Save changes before reloading (this may overwrite changes from other programs)"))    
860
 
        #    box = dlg.get_content_area()
861
 
        #    box.pack_end(checkButton)
862
 
            
863
 
        dlg.run()
864
 
        #    if self.dirty:
865
 
        #        if checkButton.get_active():
866
 
        #            self.on_save()
867
 
            
868
 
        #    dlg.destroy()
869
 
        #    Gdk.threads_leave()
870
 
        #    return True
871
 
                    
872
 
        dlg.destroy()
873
 
        Gdk.threads_leave()
874
 
        #return False
 
852
        if not self.__warnedOfChanges:
 
853
            Gdk.threads_enter()
 
854
            msg = _("Changes made in other programs will not be displayed until you\
 
855
close and reopen the AutoKey window.\nThis message is only shown once per session.")
 
856
            dlg = Gtk.MessageDialog(self.ui, type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.OK,
 
857
                                   message_format= _("Configuration has been changed on disk."))
 
858
            dlg.format_secondary_text(msg)
 
859
            
 
860
            dlg.run()
 
861
            dlg.destroy()
 
862
            Gdk.threads_leave()
 
863
            self.__warnedOfChanges = True
 
864
        
 
865
        
875
866
        
876
867
    def update_actions(self, items, changed):
877
868
        if len(items) == 0:
879
870
            canCopy = False
880
871
            canRecord = False
881
872
            canMacro = False
 
873
            canPlay = False
882
874
            enableAny = False
883
875
        else:
884
876
            canCreate = isinstance(items[0], model.Folder) and len(items) == 1
885
877
            canCopy = True
886
878
            canRecord = (not isinstance(items[0], model.Folder)) and len(items) == 1
887
879
            canMacro = isinstance(items[0], model.Phrase) and len(items) == 1
 
880
            canPlay = isinstance(items[0], model.Script) and len(items) == 1
888
881
            enableAny = True
889
882
            for item in items:
890
883
                if isinstance(item, model.Folder):
891
884
                    canCopy = False
892
885
                    break
893
886
        
894
 
        #self.uiManager.get_action("/MenuBar/File/create").set_sensitive(enableAny)
895
 
        #self.uiManager.get_action("/MenuBar/File/create/new-top-folder").set_sensitive(True)
896
 
        #self.uiManager.get_action("/MenuBar/File/create/new-folder").set_sensitive(canCreate)
897
 
        #self.uiManager.get_action("/MenuBar/File/create/new-phrase").set_sensitive(canCreate)
898
 
        #self.uiManager.get_action("/MenuBar/File/create/new-script").set_sensitive(canCreate)
899
 
        
900
887
        self.uiManager.get_action("/MenuBar/Edit/copy-item").set_sensitive(canCopy)
901
888
        self.uiManager.get_action("/MenuBar/Edit/cut-item").set_sensitive(enableAny)
902
889
        self.uiManager.get_action("/MenuBar/Edit/clone-item").set_sensitive(canCopy)
905
892
        self.uiManager.get_action("/MenuBar/Edit/rename").set_sensitive(enableAny)
906
893
        self.uiManager.get_action("/MenuBar/Edit/insert-macro").set_sensitive(canMacro)
907
894
        self.uiManager.get_action("/MenuBar/Tools/record").set_sensitive(canRecord)
908
 
        self.uiManager.get_action("/MenuBar/Tools/run").set_sensitive(canRecord)
 
895
        self.uiManager.get_action("/MenuBar/Tools/run").set_sensitive(canPlay)
909
896
        
910
897
        
911
898
        if changed:
1153
1140
        theModel, selectedPaths = selection.get_selected_rows()
1154
1141
        refs = []
1155
1142
        for path in selectedPaths:
1156
 
            refs.append(Gtk.TreeRowReference(theModel, path))
 
1143
            refs.append(Gtk.TreeRowReference.new(theModel, path))
1157
1144
 
1158
1145
        modified = False
1159
1146
        
1329
1316
        dlg.destroy()
1330
1317
    
1331
1318
    def on_treeWidget_row_activated(self, widget, path, viewColumn, data=None):
1332
 
        widget.expand_row(path, False)
 
1319
        if widget.row_expanded(path):
 
1320
            widget.collapse_row(path)
 
1321
        else:
 
1322
            widget.expand_row(path, False)
1333
1323
        
1334
1324
    def on_treeWidget_row_collapsed(self, widget, tIter, path, data=None):
1335
1325
        widget.columns_autosize()