Beispiel #1
0
    def create_toolbar(self, dataset=True, report=True, help=True):
        self.toolbar_standard = wx.aui.AuiToolBar(self, id=wx.ID_ANY)

        if self.permissions == None:
            self.permissions = {}

        if self.permissions.get('save') <> False:
            self.toolbar_standard.AddTool(self.ID_SAVE, "Speichern",
                                          IconSet22.getfilesave_22Bitmap(),
                                          'speichern')
            self.toolbar_standard.Bind(wx.EVT_TOOL,
                                       self.on_save,
                                       id=self.ID_SAVE)

        if self.permissions.get('delete') <> False:
            self.toolbar_standard.AddTool(self.ID_DELETE, "Löschen",
                                          IconSet22.getdelete_22Bitmap(),
                                          u'löschen')
            self.toolbar_standard.Bind(wx.EVT_TOOL,
                                       self.on_delete,
                                       id=self.ID_DELETE)

        if self.permissions.get('print') <> False:
            self.toolbar_standard.AddTool(self.ID_PRINT, "Drucken",
                                          IconSet22.getprint_22Bitmap(),
                                          u'drucken')
            self.toolbar_standard.Bind(wx.EVT_TOOL,
                                       self.on_print,
                                       id=self.ID_PRINT)

        # If no primary key is there, just deactivate delete and print!
        if self.primary_key == None:
            self.toolbar_standard.EnableTool(self.ID_DELETE, False)
            self.toolbar_standard.EnableTool(self.ID_PRINT, False)
Beispiel #2
0
 def create_toolbar(self, dataset=True, report=True, help=True):
     self.toolbar_standard = wx.aui.AuiToolBar(self, id=wx.ID_ANY) 
     
     if self.permissions == None:
         self.permissions = {}
         
     if self.permissions.get('save') <> False:
         self.toolbar_standard.AddTool(self.ID_SAVE, "Speichern", IconSet22.getfilesave_22Bitmap(), 'speichern')
         self.toolbar_standard.Bind(wx.EVT_TOOL, self.on_save, id=self.ID_SAVE)
     
     if self.permissions.get('delete') <> False:
         self.toolbar_standard.AddTool(self.ID_DELETE, "Löschen", IconSet22.getdelete_22Bitmap(), u'löschen')
         self.toolbar_standard.Bind(wx.EVT_TOOL, self.on_delete, id=self.ID_DELETE)
     
     if self.permissions.get('print') <> False:
         self.toolbar_standard.AddTool(self.ID_PRINT, "Drucken", IconSet22.getprint_22Bitmap(), u'drucken')
         self.toolbar_standard.Bind(wx.EVT_TOOL, self.on_print, id=self.ID_PRINT)
     
     # If no primary key is there, just deactivate delete and print!
     if self.primary_key == None:
         self.toolbar_standard.EnableTool(self.ID_DELETE, False)
         self.toolbar_standard.EnableTool(self.ID_PRINT,  False)
Beispiel #3
0
 def create_toolbar(self):
     self.toolbar_parent.SetToolBitmapSize(wx.Size(22, 22))
         
     if self.form <> None:
         if self.permissions.get('new') <> False:
             self.toolbar_parent.AddTool(self.ID_NEW,     "Neu",        IconSet22.getfilenew_22Bitmap(), 'neu')
             self.toolbar_parent.Bind(wx.EVT_TOOL, self.new, id=self.ID_NEW)
             
         if self.permissions.get('edit') <> False:    
             self.toolbar_parent.AddTool(self.ID_EDIT,    "Bearbeiten", IconSet22.getedit_22Bitmap(), 'bearbeiten')
             self.toolbar_parent.Bind(wx.EVT_TOOL, self.edit, id=self.ID_EDIT)
             
         if self.permissions.get('delete') <> False:    
             self.toolbar_parent.AddTool(self.ID_DELETE, u"Löschen",    IconSet22.getdelete_22Bitmap(), u'löschen')
             self.toolbar_parent.Bind(wx.EVT_TOOL, self.delete, id=self.ID_DELETE)
             
     if (self.permissions.get('new') or \
         self.permissions.get('edit') or \
         self.permissions.get('delete')) <> False:
         self.toolbar_parent.AddSeparator()
     
     if self.permissions.get('print') <> False:
         self.toolbar_parent.AddTool(self.ID_PRINT, "Drucken",          IconSet22.getprint_22Bitmap(), 'drucken')
         self.toolbar_parent.Bind(wx.EVT_TOOL, self.on_print, id=self.ID_PRINT)
     
     if self.permissions.get('export') <> False:
         self.toolbar_parent.AddTool(self.ID_EXPORT_TABLE, "Tabelle exportieren", IconSet22.getspreadsheet_22Bitmap(), 'Tabelle exportieren')
         self.toolbar_parent.Bind(wx.EVT_TOOL, self.on_export, id=self.ID_EXPORT_TABLE)
     
     #if search == True:
     if (self.permissions.get('print') or \
         self.permissions.get('export')) <> False:
         self.toolbar_parent.AddSeparator() 
     
     self.entry_search = wx.SearchCtrl(parent=self.toolbar_parent, id=-1)
     self.entry_search.SetDescriptiveText('Volltextsuche')
     self.entry_search.Bind(wx.EVT_TEXT_ENTER, self.on_search)
     self.toolbar_parent.AddControl(self.entry_search) 
     
     #if filter == True:
     self.toolbar_parent.AddSeparator()
     self.combobox_filter = wx.ComboBox(
         parent=self.toolbar_parent, id=-1, choices=['<alle>', 'letzte 100', 'letzte 500', 'letzte 1000'],
         size=(150,-1), style=wx.CB_DROPDOWN)
     self.combobox_filter.SetToolTip(wx.ToolTip('Filter'))
     self.combobox_filter.SetSelection(2)
     self.fetch = 500
     self.combobox_filter.Bind(wx.EVT_COMBOBOX, self.on_combobox_filter_changed)
     self.toolbar_parent.AddControl(self.combobox_filter)
     
     #if preferences == True or help == True:
     #self.toolbar_parent.AddSeparator()
     
     #if preferences == True:
     #self.toolbar_parent.AddTool(self.ID_PREFERENCES, "Einstellungen", IconSet16.getpreferences_16Bitmap())
     #self.toolbar_parent.Bind(wx.EVT_TOOL, self.on_preferences, id=self.ID_PREFERENCES)
     
     #if self.help_path <> None:
     #    self.toolbar_parent.AddLabelTool(self.ID_HELP, label="Hilfe", bitmap=IconSet16.gethelp_16Bitmap())
     #    self.toolbar_parent.Bind(wx.EVT_TOOL, self.on_help, id=self.ID_HELP)
     
     self.toolbar_parent.Realize()
Beispiel #4
0
    def create_toolbar(self):
        self.toolbar_parent.SetToolBitmapSize(wx.Size(22, 22))

        if self.form <> None:
            if self.permissions.get('new') <> False:
                self.toolbar_parent.AddTool(self.ID_NEW, "Neu",
                                            IconSet22.getfilenew_22Bitmap(),
                                            'neu')
                self.toolbar_parent.Bind(wx.EVT_TOOL, self.new, id=self.ID_NEW)

            if self.permissions.get('edit') <> False:
                self.toolbar_parent.AddTool(self.ID_EDIT, "Bearbeiten",
                                            IconSet22.getedit_22Bitmap(),
                                            'bearbeiten')
                self.toolbar_parent.Bind(wx.EVT_TOOL,
                                         self.edit,
                                         id=self.ID_EDIT)

            if self.permissions.get('delete') <> False:
                self.toolbar_parent.AddTool(self.ID_DELETE, u"Löschen",
                                            IconSet22.getdelete_22Bitmap(),
                                            u'löschen')
                self.toolbar_parent.Bind(wx.EVT_TOOL,
                                         self.delete,
                                         id=self.ID_DELETE)

        if (self.permissions.get('new') or \
            self.permissions.get('edit') or \
            self.permissions.get('delete')) <> False:
            self.toolbar_parent.AddSeparator()

        if self.permissions.get('print') <> False:
            self.toolbar_parent.AddTool(self.ID_PRINT, "Drucken",
                                        IconSet22.getprint_22Bitmap(),
                                        'drucken')
            self.toolbar_parent.Bind(wx.EVT_TOOL,
                                     self.on_print,
                                     id=self.ID_PRINT)

        if self.permissions.get('export') <> False:
            self.toolbar_parent.AddTool(self.ID_EXPORT_TABLE,
                                        "Tabelle exportieren",
                                        IconSet22.getspreadsheet_22Bitmap(),
                                        'Tabelle exportieren')
            self.toolbar_parent.Bind(wx.EVT_TOOL,
                                     self.on_export,
                                     id=self.ID_EXPORT_TABLE)

        #if search == True:
        if (self.permissions.get('print') or \
            self.permissions.get('export')) <> False:
            self.toolbar_parent.AddSeparator()

        self.entry_search = wx.SearchCtrl(parent=self.toolbar_parent, id=-1)
        self.entry_search.SetDescriptiveText('Volltextsuche')
        self.entry_search.Bind(wx.EVT_TEXT_ENTER, self.on_search)
        self.toolbar_parent.AddControl(self.entry_search)

        #if filter == True:
        self.toolbar_parent.AddSeparator()
        self.combobox_filter = wx.ComboBox(
            parent=self.toolbar_parent,
            id=-1,
            choices=['<alle>', 'letzte 100', 'letzte 500', 'letzte 1000'],
            size=(150, -1),
            style=wx.CB_DROPDOWN)
        self.combobox_filter.SetToolTip(wx.ToolTip('Filter'))
        self.combobox_filter.SetSelection(2)
        self.fetch = 500
        self.combobox_filter.Bind(wx.EVT_COMBOBOX,
                                  self.on_combobox_filter_changed)
        self.toolbar_parent.AddControl(self.combobox_filter)

        #if preferences == True or help == True:
        #self.toolbar_parent.AddSeparator()

        #if preferences == True:
        #self.toolbar_parent.AddTool(self.ID_PREFERENCES, "Einstellungen", IconSet16.getpreferences_16Bitmap())
        #self.toolbar_parent.Bind(wx.EVT_TOOL, self.on_preferences, id=self.ID_PREFERENCES)

        #if self.help_path <> None:
        #    self.toolbar_parent.AddLabelTool(self.ID_HELP, label="Hilfe", bitmap=IconSet16.gethelp_16Bitmap())
        #    self.toolbar_parent.Bind(wx.EVT_TOOL, self.on_help, id=self.ID_HELP)

        self.toolbar_parent.Realize()