def set_disconnected(self): bitmap = IconSet16.getconnect_no_16Bitmap() self.togglebutton_connect.SetBitmapLabel(bitmap) bitmap = IconSet16.getconnect_creating_16Bitmap() self.togglebutton_connect.SetBitmapSelected(bitmap) self.togglebutton_connect.SetToggle(False) self.set_enabled(True)
def __init__(self, parent): """ If autosave = False, there is a save-button appearing! """ #TODO: Save button for autosave has to be implemented! res.Portlets.Database.__init__(self, parent) self.engines_list = [] self.drivers_list = [] self.on_connect = None self.on_disconnect = None self.combobox_engine.Bind(wx.EVT_TEXT, self.on_combobox_engine_changed) self.combobox_odbc.Bind(wx.EVT_TEXT, self.on_combobox_odbc_changed) self.togglebutton_connect = BitmapToggleButton(self, \ label_bitmap=IconSet16.getconnect_no_16Bitmap(), \ selected_bitmap = IconSet16.getconnect_creating_16Bitmap() ) self.togglebutton_connect.Bind(wx.EVT_BUTTON, self.on_togglebutton_connect_toggled) self.sizer_button.Add(self.togglebutton_connect, 1, wx.ALIGN_RIGHT|wx.ALL, 5)
def __init__(self, parent, preferences=True, help=True): wx.ToolBar.__init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TB_FLAT | wx.TB_NODIVIDER) self.SetToolBitmapSize(wx.Size(22, 22)) self.AddLabelTool(id=wx.ID_ANY, label="Speichern", bitmap=IconSet16.getfilesave_16Bitmap()) self.AddLabelTool(id=wx.ID_ANY, label="Löschen", bitmap=IconSet16.getdelete_16Bitmap()) self.AddSeparator() self.AddLabelTool(id=wx.ID_ANY, label="Drucken", bitmap=IconSet16.getprint_16Bitmap()) if preferences == True or help == True: self.AddSeparator() if preferences == True: self.AddLabelTool(id=-1, label="Einstellungen", bitmap=IconSet16.getpreferences_16Bitmap()) if help == True: self.AddLabelTool(id=-1, label="Hilfe", bitmap=IconSet16.gethelp_16Bitmap()) self.Realize()
def __init__(self, parent): """ If autosave = False, there is a save-button appearing! """ #TODO: Save button for autosave has to be implemented! res.Portlets.Database.__init__(self, parent) self.engines_list = [] self.drivers_list = [] self.on_connect = None self.on_disconnect = None self.combobox_engine.Bind(wx.EVT_TEXT, self.on_combobox_engine_changed) self.combobox_odbc.Bind(wx.EVT_TEXT, self.on_combobox_odbc_changed) self.togglebutton_connect = BitmapToggleButton(self, \ label_bitmap=IconSet16.getconnect_no_16Bitmap(), \ selected_bitmap = IconSet16.getconnect_creating_16Bitmap() ) self.togglebutton_connect.Bind(wx.EVT_BUTTON, self.on_togglebutton_connect_toggled) self.sizer_button.Add(self.togglebutton_connect, 1, wx.ALIGN_RIGHT | wx.ALL, 5)
def set_connected(self): bitmap = IconSet16.getconnect_established_16Bitmap() self.togglebutton_connect.SetBitmapSelected(bitmap) self.togglebutton_connect.SetToggle(True) self.set_enabled(False)
def initialize(self, definition_lod=None, attributes_lod=None): ''' Initializes a treeview as table or tree. The definition_lod will be merged with the attributes_lod, thus the attributes_lod can be already contained in the definition_lod if desired! definition_lod = [{'column_name': 'id', 'column_label': 'Primärschlüssel', 'visible': True, 'editable': True, 'sortable': True, 'resizeable': True, 'reorderable': True, 'width': 175, 'dateformat': '%d.%m.%Y}] attributes_lod = [{'column_name': 'id' 'data_type': 'bigint' => #image makes a pixbuf column => #combobox makes a combobox column => #progressbar makes a progressbar column 'character_maximum_length': = 20 'numeric_precision' = 2 'numeric_scale' = ? 'is_nullable' = True}]''' self.definition_lod = definition_lod # Merge definition_lod and attributes_lod together. self.definition_lod = merge_two_lods(self.definition_lod, attributes_lod, 'column_name') # First off, the columns has to be sorted in given order. try: self.definition_lod.sort(compare_by('column_number')) except: raise # Before anything else happens on the treeview, clear it. self.clear() # Make image list to populate them later! self.image_list = wx.ImageList(16, 16) self.ID_LEFT = self.image_list.Add(IconSet16.getleft_16Bitmap()) self.ID_UP = self.image_list.Add(IconSet16.getup_16Bitmap()) self.ID_DOWN = self.image_list.Add(IconSet16.getdown_16Bitmap()) self.SetImageList(self.image_list) column_number = 0 for column_dict in self.definition_lod: column_label = column_dict.get('column_label') if column_label == None: column_label = column_dict.get('column_name') visible = column_dict.get('visible') if visible <> False: visible = True self.AddColumn(text=column_label) column_dict['column_number'] = column_number else: continue sortable = column_dict.get('sortable') if sortable <> False: self.SetColumnImage(column=column_number, image=self.ID_LEFT) width = column_dict.get('width') if width <> None: self.SetColumnWidth(column_number, width) column_number += 1 self.number_of_columns = column_number