Changeset 281


Ignore:
Timestamp:
07/28/09 08:02:40 (3 years ago)
Author:
marc
Message:

new global for itaka min screen height, expander will hide prefs too

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/config.py

    r278 r281  
    4949image_dir = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), 'share/images/') 
    5050system = os.name 
     51#: Minimum screen height to display all panes of Itaka 
     52min_screen_height = 800 
    5153 
    5254#: To be changed on install to specify where the installed files actually are 
  • trunk/uigtk.py

    r280 r281  
    404404 
    405405        self.button_preferences = gtk.Button('Preferences', gtk.STOCK_PREFERENCES) 
    406         self.button_preferences.connect('clicked', self.expand_preferences) 
     406        self.button_preferences.connect('clicked', self._expand_preferences) 
    407407 
    408408        # Set up some variables for our timeouts/animations 
     
    477477        self.button_log_clear_image.set_from_stock(gtk.STOCK_CLEAR, gtk.ICON_SIZE_BUTTON) 
    478478        self.button_log_clear.set_image(self.button_log_clear_image) 
    479         self.button_log_clear.connect('clicked', self.clear_logger) 
     479        self.button_log_clear.connect('clicked', self._clear_logger) 
    480480 
    481481        self.button_log_pause = gtk.ToggleButton(_('Pause')) 
     
    497497        self.expander = gtk.Expander(None) 
    498498        self.expander.set_label_widget(self.label_log_box) 
    499         self.expander.connect('notify::expanded', self.expand_logger) 
     499        self.expander.connect('notify::expanded', self._expand_logger) 
    500500 
    501501        self.vbox.pack_start(self.hbox_status, False, False, 4) 
     
    623623 
    624624        self.button_preferences_close = gtk.Button('Close', gtk.STOCK_SAVE) 
    625         self.button_preferences_close.connect('clicked', self.contractpreferences) 
     625        self.button_preferences_close.connect('clicked', self._contract_preferences) 
    626626         
    627627        self.button_preferences_about = gtk.Button('About', gtk.STOCK_ABOUT) 
     
    798798                self.log.failure(('Gui', '_save_preferences'), _('Could not save preferences'), 'ERROR') 
    799799 
    800     def expand_preferences(self, *args): 
     800    def _expand_preferences(self, *args): 
    801801        """ 
    802802        Expands the window for preferences 
     
    807807        # start timer, resize, catch configure-notify, set up idle handler, when idle resize to what the size should be at this point of time, repeat 
    808808        if not self.preferences_expanded: 
    809             if ((gtk.gdk.screen_height() < 800) and self.expander.get_property("expanded")): 
     809            # Close log in small screen displays 
     810            if ((gtk.gdk.screen_height() < self.itaka_globals.min_screen_height) and self.expander.get_property("expanded")): 
    810811                self.expander.set_expanded(False) 
     812 
    811813            if self.timeout_expand is not None: 
    812814                """NOTE: GTK+ GtkWidget.size_request() method can give you the amount of size a widget will take 
     
    853855                    return False 
    854856            else: 
    855                 self.timeout_expand = gobject.timeout_add(30, self.expand_preferences) 
    856  
    857     def contractpreferences(self, *args): 
     857                self.timeout_expand = gobject.timeout_add(30, self._expand_preferences) 
     858 
     859    def _contract_preferences(self, save): 
    858860        """ 
    859861        Contracts the window of preferences 
     862 
     863        @type args: unknown 
     864        @param args: gtk.Widget or "False" if you don't want to save preferences, just hide the pane 
    860865        """ 
    861866 
     
    883888                self.button_preferences.set_sensitive(True) 
    884889                 
    885                 # Save our settings  
    886                 self._save_preferences() 
     890                # Save our settings (but not if we are on small displays and we just want to hide the pane) 
     891                if save is not False: 
     892                    print_m("Saving") 
     893                    self._save_preferences() 
    887894 
    888895                self.timeout_contract = None 
    889896                return False 
    890897        else: 
    891             self.timeout_contract = gobject.timeout_add(30, self.contractpreferences) 
     898            self.timeout_contract = gobject.timeout_add(30, self._contract_preferences, save) 
    892899 
    893900    def _window_size_changed(self, widget=None, data=None): 
     
    917924         
    918925        @type widget: instance 
    919         @SAVE widget: gtk.Widget 
     926        @param widget: gtk.Widget 
    920927 
    921928        @type button: int 
    922         @SAVE button: The button pressed. 
     929        @param button: The button pressed. 
    923930 
    924931        @type time: unknown 
     
    10121019        self.about_dialog.destroy() 
    10131020 
    1014     def expand_logger(self, expander, params): 
     1021    def _expand_logger(self, expander, params): 
    10151022        """ 
    10161023        Expand or contract the logger 
     
    10241031 
    10251032        if self.expander.get_expanded(): 
     1033            # Close preferences pane in small screen displays 
     1034            if ((gtk.gdk.screen_height() < self.itaka_globals.min_screen_height) and self.preferences_expanded): 
     1035                # Tell it to not save 
     1036                self._contract_preferences(False) 
     1037 
    10261038            # Show the debugvbox() and it's subwidgets 
    10271039            self.vbox_log.show_all() 
     
    10331045        return 
    10341046 
    1035     def clear_logger(self, *args): 
     1047    def _clear_logger(self, *args): 
    10361048        """ 
    10371049        Clear the log 
Note: See TracChangeset for help on using the changeset viewer.