コード例 #1
0
 def __init__ (self):
     self.init_player()
     self.ui = gtk.Builder()
     self.ui.add_from_file(os.path.join(gglobals.uibase,'timerDialog.ui'))
     self.timer = TimeSpinnerUI(
         self.ui.get_object('hoursSpinButton'),
         self.ui.get_object('minutesSpinButton'),
         self.ui.get_object('secondsSpinButton')
         )
     self.timer.connect_timer_hook(self.timer_done_cb)
     for w in ['timerDialog','mainLabel',
               'soundComboBox','repeatCheckButton',
               'noteEntry','expander1','timerBox','resetTimerButton',
               'timerFinishedLabel','keepAnnoyingLabel'
               ]:
         setattr(self,w,self.ui.get_object(w))
     cb.set_model_from_list(self.soundComboBox,self.sounds_and_files.keys())
     cb.cb_set_active_text(self.soundComboBox,_('Ringing Sound'))
     self.ui.connect_signals(
         {'reset_cb':self.timer.reset_cb,
          'pause_cb':self.timer.pause_cb,
          'start_cb':self.timer.start_cb,
          'note_changed_cb':self.note_changed_cb,
          }
         )
     self.timerDialog.connect('response',self.response_cb)
     self.timerDialog.connect('close',self.close_cb)
     self.timerDialog.set_modal(False)
     self.note = ''
コード例 #2
0
ファイル: recindex.py プロジェクト: Agrajag-Petunia/gourmet
 def set_search_by(self, str):
     """Manually set the search by label to str"""
     debug('set_search_by', 1)
     #self.rSearchByMenu.get_children()[0].set_text(str)
     cb.cb_set_active_text(self.rSearchByMenu, str)
     self.search()
コード例 #3
0
ファイル: recindex.py プロジェクト: aamorrison/gourmet
 def set_search_by (self, str):
     """Manually set the search by label to str"""
     debug('set_search_by',1)
     #self.rSearchByMenu.get_children()[0].set_text(str)
     cb.cb_set_active_text(self.rSearchByMenu, str)
     self.search()
コード例 #4
0
 def __init__ (self, converter=None,
               unitModel=None,
               amt1=None, unit1=None, item=None,
               okcb=None
               ):
     self.possible_conversions = None
     self.ui = gtk.Builder()
     self.ui.add_from_file(os.path.join(uibase,'converter.ui'))
     self.conv = convert.get_converter()
     self.changing_item = False
     self.okcb = okcb
     self.widget_names = ['window','amt1Entry', 'amt2Label', 'unit1ComboBox', 'unit2ComboBox',
                'itemComboBox', 'densitySpinButton', 'useDensityCheckButton', 'statusbar','expander1','messageLabel']
     # grab all our widgets
     for w in self.widget_names:
         setattr(self,w,self.ui.get_object(w))
     # HACK FOR READABILITY w/o glade change
     self.resultLabel = self.amt2Label
     self.resultLabel.set_use_markup(True)
     self.resultLabel.set_line_wrap(True)
     if unitModel: self.unitModel=unitModel
     else: self.unitModel=UnitModel(self.conv)
     #self.unit2Model = self.unitModel.filter_new()
     self.unit1ComboBox.set_model(self.unitModel)
     self.unit1ComboBox.set_wrap_width(3)
     self.unit2ComboBox.set_wrap_width(3)        
     #self.unit2Model.set_visible_func(self.unit_filter)
     #self.unit2ComboBox.set_model(self.unit2Model)
     self.unit2ComboBox.set_model(self.unitModel)
     for combobox in [self.unit1ComboBox, self.unit2ComboBox]:
         cell = gtk.CellRendererText()            
         combobox.pack_start(cell, True)
         combobox.add_attribute(cell, 'text', 1)
         setup_typeahead(combobox)
     #self.itemComboBox.append_text('None')
     ikeys = self.conv.density_table.keys()
     ikeys.sort()
     for itm in ikeys:
         self.itemComboBox.append_text(itm)
     if len(self.conv.density_table.keys()) > 8:
         self.itemComboBox.set_wrap_width(3)
     setup_typeahead(self.itemComboBox)
     if amt1:
         self.amt1Entry=self.conv.float_to_frac(amt1)
     self.ui.connect_signals({
         'amt1changed':self.changed,
         'unit1changed':self.changed,
         'unit2changed':self.changed,
         'itemChanged':self.density_itm_changed,
         'densitySpinChanged':self.density_spin_changed,
         'densityChecked':self.density_toggled,
         'close':self.close,
         })
     self.last_amt1 = None
     self.last_amt2 = None
     self.last_unit1 = None
     self.last_unit2 = None
     if unit1 and self.conv.unit_dict.has_key[unit1]:
         u = self.conv.unit_dict[unit1]
         cb_set_active_text(self.unit1ComboBox,u)
     if amt1: self.amt1Entry.set_text("%s"%amt1)
     if item: cb_set_active_text(self.itemComboBox,item)