def data_editor_enable(self, event): self.item = self.list_update.GetFocusedItem() if not self.item == -1: amount, unit = self.list_update.GetItemText(self.item, 2).split() self.textbox_product_description.SetValue( self.list_update.GetItemText(self.item, 1)) self.textbox_product_id.SetValue( str(self.list_update.GetItemData(self.item))) self.textbox_product_price.SetValue( self.list_update.GetItemText(self.item, 3)) self.textbox_product_amount.SetValue(amount) self.textbox_product_unit.SetValue(unit) self.__panel_product.Destroy() self.__panel_product = wx.Panel(self.panel_product_data, size=(200, 40), pos=(200, 210), style=wx.SIMPLE_BORDER) eplus = GenBitmapTextButton( self.__panel_product, 220, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u"Salvar", pos=(0, 0), size=(100, 40)) eplus.Bind(wx.EVT_BUTTON, self.data_edit) eremov = GenBitmapTextButton( self.__panel_product, 222, wx.Bitmap(core.directory_paths['icons'] + 'Cancel.png', wx.BITMAP_TYPE_PNG), u'Cancelar', pos=(100, 0), size=(100, 40)) eremov.Bind(wx.EVT_BUTTON, self.data_editor_disable)
def __init__(self, parent, data, title=u'Aviso de Entrega!'): """ Método construtor do Dialog para """ wx.Dialog.__init__(self, parent, wx.ID_ANY, title, size=(500, 230)) self.Centre() self.image = None self.data = data self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) textbox_message = wx.TextCtrl(self, wx.ID_ANY, self.get_message(), pos=(75, 50), size=(400, 90), style=wx.NO_BORDER | wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_NO_VSCROLL | wx.TE_BESTWRAP) textbox_message.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) panel_side_buttons = wx.Panel(self, pos=(100, 150), size=(370, 40), style=wx.SIMPLE_BORDER) button_show_more = GenBitmapTextButton( panel_side_buttons, wx.ID_ANY, wx.Bitmap(core.directory_paths['icons'] + 'Search.png'), u'Ver Mais', pos=(0, 0), size=(100, 40)) button_ok = GenBitmapTextButton( panel_side_buttons, wx.ID_OK, wx.Bitmap(core.directory_paths['icons'] + 'Check.png'), u'OK', pos=(100, 0), size=(100, 40)) button_done = GenBitmapTextButton( panel_side_buttons, wx.ID_EXIT, wx.Bitmap(core.directory_paths['icons'] + 'Delivery.png'), self.text_done, pos=(200, 0), size=(170, 40), style=wx.BU_LEFT) button_show_more.Bind(wx.EVT_BUTTON, self.more) button_ok.Bind(wx.EVT_BUTTON, self.exit) button_done.Bind(wx.EVT_BUTTON, self.ready) panel_side_buttons.SetFocus() wx.EVT_PAINT(self, self.OnPaint)
def setup_gui(self): self.SetIcon(wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO)) self.Centre() self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) panel_original = wx.Panel(self, -1, size=(730, 380), pos=(10, 10), style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL) self.list_edited_data = wx.gizmos.TreeListCtrl( panel_original, -1, pos=(10, 10), size=(710, 360), style=wx.SIMPLE_BORDER | wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT) self.list_edited_data.AddColumn(u"Horário", width=120) self.list_edited_data.AddColumn(u"ID", width=95) self.list_edited_data.AddColumn(u"Descrição", width=210) self.list_edited_data.AddColumn(u"Quantidade", width=90) self.list_edited_data.AddColumn(u"Valor", width=100) self.list_edited_data.SetMainColumn(0) self.list_edited_data.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.process_click) self.panel_control = wx.Panel(self, -1, size=(240, 380), pos=(750, 10), style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL) wx.StaticText(self.panel_control, -1, u"Registros de", pos=(5, 80)) see = GenBitmapTextButton( self.panel_control, -1, wx.Bitmap(core.directory_paths['icons'] + 'Report.png', wx.BITMAP_TYPE_PNG), u"Ver mais sobre o registro", pos=(5, 180), size=(230, 50), style=wx.SIMPLE_BORDER) see.Bind(wx.EVT_BUTTON, self.process_click) rec = GenBitmapTextButton( self.panel_control, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), u"Recuperar registro", pos=(5, 230), size=(230, 50), style=wx.SIMPLE_BORDER) rec.Bind(wx.EVT_BUTTON, self.ask_remove)
def setup_gui(self): self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.SetIcon(wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO)) panel_deliveries = wx.Panel(self, -1, size=(730, 380), pos=(10, 10), style=wx.DOUBLE_BORDER | wx.TAB_TRAVERSAL) panel_deliveries.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.list_deliveries = wx.gizmos.TreeListCtrl(panel_deliveries, -1, pos=(10, 10), size=(710, 360), style=wx.SIMPLE_BORDER | wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT) self.list_deliveries.AddColumn(u"Data", width=120) self.list_deliveries.AddColumn(u"Horário", width=120) self.list_deliveries.AddColumn(u"Endereço", width=300) self.list_deliveries.AddColumn(u"Para", width=160) self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.open_view_sale, self.list_deliveries) panel_right = wx.Panel(self, -1, size=(200, 380), pos=(750, 10), style=wx.DOUBLE_BORDER | wx.TAB_TRAVERSAL) panel_right.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) show_options = [u'Apenas entregas ativas', u'Todas as entregas cadastradas'] self.combobox_show_option = wx.ComboBox(panel_right, choices=show_options, size=(190, -1), pos=(2, 20), style=wx.CB_READONLY | wx.TE_MULTILINE) self.combobox_show_option.SetValue(show_options[0]) self.combobox_show_option.Bind(wx.EVT_COMBOBOX, self.setup) maps = wx.BitmapButton(panel_right, -1, wx.Bitmap(core.directory_paths['icons'] + 'map_icon_48.png'), pos=(76, 76), size=(48, 48), style=wx.NO_BORDER) maps.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) maps.Bind(wx.EVT_BUTTON, self.open_maps) tell = wx.Button(panel_right, -1, u'Mostrar mais', pos=(50, 150), size=(100, 30)) tell.Bind(wx.EVT_BUTTON, self.open_view_sale) panel_side_buttons = wx.Panel(panel_right, pos=(40, 220), size=(120, 120), style=wx.SIMPLE_BORDER) change_delivery_status = GenBitmapTextButton(panel_side_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Delivery.png'), u"Realizada", pos=(0, 0), size=(120, 40)) change_delivery_status.Bind(wx.EVT_BUTTON, self.change_delivery_status) up = GenBitmapTextButton(panel_side_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png'), u"Atualizar", pos=(0, 40), size=(120, 40)) up.Bind(wx.EVT_BUTTON, self.setup) down = GenBitmapTextButton(panel_side_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png'), u'Sair', pos=(0, 80), size=(120, 40)) down.Bind(wx.EVT_BUTTON, self.exit)
def data_editor_disable(self, event): self.textbox_product_unit.Clear() self.textbox_product_amount.Clear() self.textbox_product_price.Clear() self.textbox_product_id.Clear() self.textbox_product_description.Clear() self.__panel_product.Destroy() self.__panel_product = wx.Panel(self.panel_product_data, size=(300, 40), pos=(100, 210), style=wx.SIMPLE_BORDER) button_add_product = GenBitmapTextButton( self.__panel_product, 220, wx.Bitmap(core.directory_paths['icons'] + 'Add.png', wx.BITMAP_TYPE_PNG), u"Adicionar", pos=(0, 0), size=(100, 40)) button_add_product.Bind(wx.EVT_BUTTON, self.data_insert, id=220) button_product_editor = GenBitmapTextButton( self.__panel_product, 221, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u'Editar', pos=(100, 0), size=(100, 40)) button_product_editor.Bind(wx.EVT_BUTTON, self.data_editor_enable, id=221) button_remove_product = GenBitmapTextButton( self.__panel_product, 222, wx.Bitmap(core.directory_paths['icons'] + 'Trash.png', wx.BITMAP_TYPE_PNG), u'Apagar', pos=(200, 0), size=(100, 40)) button_remove_product.Bind(wx.EVT_BUTTON, self.data_delete, id=222)
def __init__(self, parent, month, title=u'Tabelas', sheet_to_focus=1): wx.Frame.__init__(self, parent, -1, title, size=(970, 600)) self.month = month self.parent = parent self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.SetIcon(wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO)) box = wx.BoxSizer(wx.VERTICAL) note = wx.Notebook(self, style=wx.LEFT) if sheet_to_focus == 1: self.main1 = Sheet(note, 'won') self.main2 = Sheet(note, 'loss') self.main3 = Sheet(note, 'prod') self.main4 = Sheet(note, 'was') elif sheet_to_focus == 2: self.main2 = Sheet(note, 'loss') self.main3 = Sheet(note, 'prod') self.main4 = Sheet(note, 'was') self.main1 = Sheet(note, 'won') elif sheet_to_focus == 3: self.main3 = Sheet(note, 'prod') self.main4 = Sheet(note, 'was') self.main1 = Sheet(note, 'won') self.main2 = Sheet(note, 'loss') elif sheet_to_focus == 4: self.main4 = Sheet(note, 'was') self.main1 = Sheet(note, 'won') self.main2 = Sheet(note, 'loss') self.main3 = Sheet(note, 'prod') note.AddPage(self.main1, u'Vendas') note.AddPage(self.main2, u'Gastos') note.AddPage(self.main3, u'Produtos') note.AddPage(self.main4, u'Desperdícios') button_exit = GenBitmapTextButton( self, -1, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png', wx.BITMAP_TYPE_PNG), u'Sair', pos=(600, -1), style=wx.SIMPLE_BORDER) button_exit.Bind(wx.EVT_BUTTON, self.exit) box.Add(note, 1, wx.EXPAND | wx.ALL, 5) box.Add(button_exit, 0, wx.ALL | wx.ALIGN_RIGHT, 15) self.SetSizer(box) note.SetSelection(sheet_to_focus - 1) self.Centre() self.Show()
class DatasetDialog(wx.Dialog): def __init__(self, *args, **kw): self.wxobj = args[0] self.verbose = self.wxobj.verbose from wx.lib.buttons import GenBitmapTextButton bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, (16, 16)) wx.Dialog.__init__(self, None, title="Dataset Dialog") self.ID_DONE = wx.NewId() self.SetSize((900, 800)) self.SetTitle("Please select files for the second condition.") mainSizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(mainSizer) warningText = """ The Genetic Interactions method requires a total of four sets of datasets. Typically these are 2 strain backgrounds (e.g. Wildtype and Knockout) each grown under two conditions (e.g. in vitro and in vivo, or rich-media and presence of antibiotic). The Control and Experimental datasets added in the main TRANSIT interface are assumed to be the two strain backgrounds grown under the first condition. This interface allows you to add the remaining datasets for the second condition. """ warningStaticBox = wx.StaticText(self, wx.ID_ANY, warningText, (-1,-1), (-1, -1), wx.EXPAND) warningStaticBox.Wrap(800) mainSizer.Add(warningStaticBox, flag=wx.CENTER, border=5) # CONTROL ctrlSizerB = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Control Samples - Condition B" ), wx.VERTICAL ) bSizer2 = wx.BoxSizer( wx.HORIZONTAL ) self.ctrlRemoveButton = wx.Button( self, wx.ID_ANY, u"Remove", wx.DefaultPosition, (96,-1), 0 ) bSizer2.Add( self.ctrlRemoveButton, 0, wx.ALL, 5 ) self.ctrlView = wx.Button( self, wx.ID_ANY, u"Track View", wx.DefaultPosition, wx.DefaultSize, 0 ) self.ctrlView.Hide() bSizer2.Add( self.ctrlView, 0, wx.ALL, 5 ) self.ctrlScatter = wx.Button( self, wx.ID_ANY, u"Scatter", wx.DefaultPosition, wx.DefaultSize, 0 ) self.ctrlScatter.Hide() bSizer2.Add( self.ctrlScatter, 0, wx.ALL, 5 ) self.ctrlFilePicker = GenBitmapTextButton(self, 1, bmp, '[Click to add Control Dataset(s)]', size= wx.Size(500, -1)) bSizer2.Add( self.ctrlFilePicker, 1, wx.ALIGN_CENTER_VERTICAL, 5 ) ctrlSizerB.Add( bSizer2, 0, wx.EXPAND, 5 ) self.list_ctrl = wx.ListCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT|wx.SUNKEN_BORDER ) self.list_ctrl.SetMaxSize(wx.Size(940,200)) ctrlSizerB.Add( self.list_ctrl, 1, wx.ALL|wx.EXPAND, 5 ) # EXPERIMENTAL expSizerB = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Experimental Samples - Condition B" ), wx.VERTICAL ) bSizer3 = wx.BoxSizer( wx.HORIZONTAL ) self.expRemoveButton = wx.Button( self, wx.ID_ANY, u"Remove", wx.DefaultPosition, (96,-1), 0 ) bSizer3.Add( self.expRemoveButton, 0, wx.ALL, 5 ) self.expView = wx.Button( self, wx.ID_ANY, u"Track View", wx.DefaultPosition, wx.DefaultSize, 0 ) self.expView.Hide() bSizer3.Add( self.expView, 0, wx.ALL, 5 ) self.expScatter = wx.Button( self, wx.ID_ANY, u"Scatter", wx.DefaultPosition, wx.DefaultSize, 0 ) self.expScatter.Hide() bSizer3.Add( self.expScatter, 0, wx.ALL, 5 ) self.expFilePicker = GenBitmapTextButton(self, 1, bmp, '[Click to add Experimental Dataset(s)]', size= wx.Size(500, -1)) bSizer3.Add( self.expFilePicker, 1, wx.ALIGN_CENTER_VERTICAL, 5 ) expSizerB.Add( bSizer3, 0, wx.EXPAND, 5 ) self.list_exp = wx.ListCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT|wx.SUNKEN_BORDER ) self.list_exp.SetMaxSize(wx.Size(940, 200)) expSizerB.Add( self.list_exp, 1, wx.ALL|wx.EXPAND, 5 ) # MAIN mainSizer.Add( ctrlSizerB, 1, wx.EXPAND, 5 ) mainSizer.Add( expSizerB, 1, wx.EXPAND, 5 ) button_sizer = wx.BoxSizer(wx.HORIZONTAL) doneButton = wx.Button(self, self.ID_DONE, label='Done') cancelButton = wx.Button(self, wx.ID_CANCEL, label='Cancel') button_sizer.Add(doneButton, flag=wx.LEFT, border=5) button_sizer.Add(cancelButton, flag=wx.LEFT, border=5) self.expFilePicker.Bind( wx.EVT_BUTTON, self.loadExpFileFunc ) self.ctrlFilePicker.Bind( wx.EVT_BUTTON, self.loadCtrlFileFunc ) mainSizer.Add(button_sizer, flag=wx.ALIGN_CENTER|wx.TOP|wx.BOTTOM, border=10) doneButton.Bind(wx.EVT_BUTTON, self.OnClose) cancelButton.Bind(wx.EVT_BUTTON, self.OnClose) self.ctrlFilePicker.Bind( wx.EVT_BUTTON, self.loadCtrlFileFunc ) self.expFilePicker.Bind( wx.EVT_BUTTON, self.loadExpFileFunc ) self.ctrlRemoveButton.Bind( wx.EVT_BUTTON, self.ctrlRemoveFunc ) self.expRemoveButton.Bind( wx.EVT_BUTTON, self.expRemoveFunc ) self.index_ctrl = 0 self.list_ctrl.InsertColumn(0, 'File', width=210) self.list_ctrl.InsertColumn(1, 'Total Reads', width=85) self.list_ctrl.InsertColumn(2, 'Density', width=85) self.list_ctrl.InsertColumn(3, 'Mean Count', width=90) self.list_ctrl.InsertColumn(4, 'Max Count', width=85) self.list_ctrl.InsertColumn(5, 'Full Path', width=403) self.index_exp = 0 self.list_exp.InsertColumn(0, 'File', width=210) self.list_exp.InsertColumn(1, 'Total Reads', width=85) self.list_exp.InsertColumn(2, 'Density', width=85) self.list_exp.InsertColumn(3, 'Mean Count', width=90) self.list_exp.InsertColumn(4, 'Max Count', width=85) self.list_exp.InsertColumn(5, 'Full Path',width=403) def OnClose(self, event): if self.IsModal(): self.EndModal(event.EventObject.Id) self.Close() else: self.Close() self.Destroy() def ctrlSelected(self, col=5): selected_ctrl = [] current = -1 while True: next = self.list_ctrl.GetNextSelected(current) if next == -1: break path = self.list_ctrl.GetItem(next, col).GetText() selected_ctrl.append(path) current = next return selected_ctrl # def loadCtrlFileFunc(self, event): try: dlg = wx.FileDialog( self, message="Choose a file", defaultDir=self.wxobj.workdir, defaultFile="", wildcard=u"Read Files (*.wig)|*.wig;|\nRead Files (*.txt)|*.txt;|\nRead Files (*.dat)|*.dat;|\nAll files (*.*)|*.*", style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR ) if dlg.ShowModal() == wx.ID_OK: paths = dlg.GetPaths() print "You chose the following Control file(s):" for fullpath in paths: print "\t%s" % fullpath self.loadCtrlFile(fullpath) dlg.Destroy() except Exception as e: transit_tools.transit_message("Error: %s" % e) exc_type, exc_obj, exc_tb = sys.exc_info() fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] print(exc_type, fname, exc_tb.tb_lineno) # def expSelected(self, col=5): selected_exp = [] current = -1 while True: next = self.list_exp.GetNextSelected(current) if next == -1: break path = self.list_exp.GetItem(next, col).GetText() selected_exp.append(path) current = next return selected_exp def loadExpFileFunc(self, event): try: dlg = wx.FileDialog( self, message="Choose a file", defaultDir=self.wxobj.workdir, defaultFile="", wildcard=u"Read Files (*.wig)|*.wig;|\nRead Files (*.txt)|*.txt;|\nRead Files (*.dat)|*.dat;|\nAll files (*.*)|*.*", style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR ) if dlg.ShowModal() == wx.ID_OK: paths = dlg.GetPaths() print "You chose the following Experimental file(s):" for fullpath in paths: print "\t%s" % fullpath self.loadExpFile(fullpath) dlg.Destroy() except Exception as e: transit_tools.transit_message("Error: %s" % e) exc_type, exc_obj, exc_tb = sys.exc_info() fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] print(exc_type, fname, exc_tb.tb_lineno) # def loadCtrlFile(self, fullpath): name = transit_tools.basename(fullpath) (density, meanrd, nzmeanrd, nzmedianrd, maxrd, totalrd, skew, kurtosis) = tnseq_tools.get_wig_stats(fullpath) self.list_ctrl.InsertItem(self.index_ctrl, name) self.list_ctrl.SetItem(self.index_ctrl, 1, "%1.1f" % (totalrd)) self.list_ctrl.SetItem(self.index_ctrl, 2, "%2.1f" % (density*100)) self.list_ctrl.SetItem(self.index_ctrl, 3, "%1.1f" % (meanrd)) self.list_ctrl.SetItem(self.index_ctrl, 4, "%d" % (maxrd)) self.list_ctrl.SetItem(self.index_ctrl, 5, "%s" % (fullpath)) self.list_ctrl.Select(self.index_ctrl) self.index_ctrl+=1 # def loadExpFile(self, fullpath): name = transit_tools.basename(fullpath) (density, meanrd, nzmeanrd, nzmedianrd, maxrd, totalrd, skew, kurtosis) = tnseq_tools.get_wig_stats(fullpath) self.list_exp.InsertItem(self.index_exp, name) self.list_exp.SetItem(self.index_exp, 1, "%1.1f" % (totalrd)) self.list_exp.SetItem(self.index_exp, 2, "%2.1f" % (density*100)) self.list_exp.SetItem(self.index_exp, 3, "%1.1f" % (meanrd)) self.list_exp.SetItem(self.index_exp, 4, "%d" % (maxrd)) self.list_exp.SetItem(self.index_exp, 5, "%s" % (fullpath)) self.list_exp.Select(self.index_exp) self.index_exp+=1 # def ctrlRemoveFunc(self, event): next = self.list_ctrl.GetNextSelected(-1) while next != -1: if self.verbose: transit_tools.transit_message("Removing control item (%d): %s" % (next, self.list_ctrl.GetItem(next, 0).GetText())) self.list_ctrl.DeleteItem(next) next = self.list_ctrl.GetNextSelected(-1) self.index_ctrl-=1 # def expRemoveFunc(self, event): next = self.list_exp.GetNextSelected(-1) while next != -1: if self.verbose: transit_tools.transit_message("Removing experimental item (%d): %s" % (next, self.list_exp.GetItem(next, 0).GetText())) self.list_exp.DeleteItem(next) next = self.list_exp.GetNextSelected(-1) self.index_exp-=1
def setup_gui(self): self.SetSize(wx.Size(500, 585)) self.SetIcon(wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO)) self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.Centre() panel_client_intel = wx.Panel(self, -1, pos=(0, 0), size=(500, 500), style=wx.TAB_TRAVERSAL) wx.StaticText(panel_client_intel, -1, u'Nome do cliente:', pos=(190, 10)) wx.StaticText(panel_client_intel, -1, u'Sexo:', pos=(190, 70)) wx.StaticText(panel_client_intel, -1, u'Data de Nascimento:', pos=(340, 70)) wx.StaticText(panel_client_intel, -1, u'CPF:', pos=(190, 130)) wx.StaticText(panel_client_intel, -1, u'Telefone:', pos=(340, 130)) wx.StaticText(panel_client_intel, -1, u'e-mail:', pos=(10, 190)) wx.StaticText(panel_client_intel, -1, u'CEP:', pos=(340, 190)) wx.StaticText(panel_client_intel, -1, u'Estado:', pos=(10, 250)) wx.StaticText(panel_client_intel, -1, u'Cidade:', pos=(100, 250)) wx.StaticText(panel_client_intel, -1, u'Bairro:', pos=(280, 250)) wx.StaticText(panel_client_intel, -1, u'Endereço:', pos=(10, 310)) wx.StaticText(panel_client_intel, -1, u'Observações:', pos=(10, 370)) self.textbox_client_name = wx.TextCtrl(panel_client_intel, -1, pos=(190, 30), size=(300, 30)) self.textbox_client_sex = wx.ComboBox(panel_client_intel, -1, choices=[u'Feminino', u'Maculino'], pos=(190, 90), size=(120, 30), style=wx.CB_READONLY) self.textbox_client_birth = wx.TextCtrl(panel_client_intel, -1, pos=(340, 90), size=(120, 30)) self.textbox_client_cpf = wx.TextCtrl(panel_client_intel, -1, pos=(190, 150), size=(120, 30)) self.textbox_client_telephone = wx.TextCtrl(panel_client_intel, -1, pos=(340, 150), size=(120, 30)) self.textbox_client_email = wx.TextCtrl(panel_client_intel, -1, pos=(10, 210), size=(300, 30)) self.textbox_client_cep = wx.TextCtrl(panel_client_intel, -1, pos=(340, 210), size=(120, 30)) self.textbox_client_state = wx.ComboBox(panel_client_intel, -1, choices=core.brazil_states, pos=(10, 270), size=(60, 30), style=wx.CB_READONLY) self.textbox_client_city = wx.TextCtrl(panel_client_intel, -1, pos=(100, 270), size=(150, 30)) self.textbox_client_district = wx.TextCtrl(panel_client_intel, -1, pos=(280, 270), size=(150, 30)) self.textbox_client_address = wx.TextCtrl(panel_client_intel, -1, pos=(10, 330), size=(300, 30)) self.textbox_client_observations = wx.TextCtrl(panel_client_intel, -1, pos=(10, 390), size=(480, 100), style=wx.TE_MULTILINE) self.textbox_client_birth.Bind(wx.EVT_CHAR, core.check_date) self.textbox_client_telephone.Bind(wx.EVT_CHAR, core.check_telephone) self.textbox_client_cep.Bind(wx.EVT_CHAR, core.check_cep) self.textbox_client_cpf.Bind(wx.EVT_CHAR, core.check_cpf) self.textbox_client_sex.SetValue(u'Feminino') self.textbox_client_birth.SetValue(u'__/__/____') self.textbox_client_state.SetValue(u'SP') self.textbox_client_city.SetValue(u'Itatiba') self.panel_client_image = wx.Panel(panel_client_intel, -1, size=(150, 150), pos=(10, 25), style=wx.SIMPLE_BORDER) self.panel_client_image.SetBackgroundColour('#ffffff') wx.EVT_PAINT(self.panel_client_image, self.OnPaint) panel_bottom = wx.Panel(self, -1, pos=(0, 500), size=(500, 50)) panel_bottom_buttons = wx.Panel(panel_bottom, pos=(90, 5), size=(320, 40), style=wx.SIMPLE_BORDER) finish = GenBitmapTextButton(panel_bottom_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Check.png', wx.BITMAP_TYPE_PNG), u"Finalizar", pos=(0, 0), size=(100, 40)) finish.Bind(wx.EVT_BUTTON, self.ask_delete) restart = GenBitmapTextButton(panel_bottom_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), u"Recomeçar", pos=(100, 0), size=(120, 40)) restart.Bind(wx.EVT_BUTTON, self.ask_clean) cancel = GenBitmapTextButton(panel_bottom_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png', wx.BITMAP_TYPE_PNG), u"Sair", pos=(220, 0), size=(100, 40)) cancel.Bind(wx.EVT_BUTTON, self.ask_exit)
def setup_gui(self): self.SetIcon((wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO))) self.Centre() self.list_update = wx.ListCtrl(self, -1, pos=(10, 280), size=(450, 275), style=wx.LC_REPORT | wx.SIMPLE_BORDER | wx.LC_VRULES | wx.LC_HRULES) self.list_update.InsertColumn(0, u"ID", width=50) self.list_update.InsertColumn(1, u"Descrição", width=180) self.list_update.InsertColumn(2, u"Quantidade") self.list_update.InsertColumn(3, u"Preço Unit.") self.radio_update = wx.RadioButton(self, -1, label=u'Atualizar estoque', pos=(10, 560), size=(225, 25), style=wx.SIMPLE_BORDER) self.radio_entry = wx.RadioButton(self, -1, label=u'Entrada de produtos', pos=(235, 560), size=(225, 25), style=wx.SIMPLE_BORDER) self.radio_update.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD)) self.radio_entry.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD)) self.radio_update.SetToolTip( wx.ToolTip(u'Dar uma nova quantidade em estoque para os produtos.' u'\nIgnora um estoque anterior.')) self.radio_entry.SetToolTip( wx.ToolTip( u'Atualiza o estoque de acordo com uma entrada de produtos.' u'\nApenas registra uma variação no estoque.')) self.radio_entry.SetValue(True) # product self.panel_product_data = wx.Panel(self, 22, pos=(10, 10), size=(450, 260), style=wx.DOUBLE_BORDER | wx.TAB_TRAVERSAL) self.panel_product_data.SetBackgroundColour( core.COLOR_DEFAULT_BACKGROUND) fin = wx.BitmapButton(self.panel_product_data, -1, wx.Bitmap(core.directory_paths['icons'] + 'Add.png'), pos=(408, 10), size=(32, 32), style=wx.NO_BORDER) fin.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) fin.Bind(wx.EVT_BUTTON, self.open_product_register) self.textbox_product_description = wx.SearchCtrl( self.panel_product_data, 223, pos=(10, 10), size=(395, 32)) self.textbox_product_description.Bind(wx.EVT_TEXT, self.database_search, id=223) self.textbox_product_description.ShowSearchButton(False) self.textbox_product_description.SetDescriptiveText( u'Descrição do produto') self.list_inventory = wx.ListCtrl(self.panel_product_data, -1, pos=(10, 45), size=(430, 115), style=wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.SIMPLE_BORDER) self.list_inventory.InsertColumn(0, u'Descrição', width=230) self.list_inventory.InsertColumn(1, u'Estoque') self.list_inventory.InsertColumn(2, u'Preço') self.list_inventory.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.database_select) self.textbox_product_id = wx.SearchCtrl(self.panel_product_data, -1, pos=(10, 170), size=(100, -1)) self.textbox_product_id.ShowSearchButton(False) self.textbox_product_id.SetDescriptiveText(u'ID') self.textbox_product_price = wx.SearchCtrl(self.panel_product_data, -1, pos=(130, 170), size=(80, -1)) self.textbox_product_price.ShowSearchButton(False) self.textbox_product_price.SetDescriptiveText(u'Preço') self.textbox_product_price.SetValue(u'R$ 0,00') self.textbox_product_price.Disable() self.textbox_product_amount = wx.SearchCtrl(self.panel_product_data, -1, pos=(230, 170), size=(100, -1)) self.textbox_product_amount.ShowSearchButton(False) self.textbox_product_amount.SetDescriptiveText(u'Quantidade') self.textbox_product_unit = wx.TextCtrl(self.panel_product_data, -1, pos=(335, 175), size=(50, -1), style=wx.NO_BORDER | wx.TE_READONLY) self.textbox_product_unit.SetBackgroundColour( core.COLOR_DEFAULT_BACKGROUND) self.__panel_product = wx.Panel(self.panel_product_data, size=(300, 40), pos=(100, 210), style=wx.SIMPLE_BORDER) button_add_product = GenBitmapTextButton( self.__panel_product, 220, wx.Bitmap(core.directory_paths['icons'] + 'Add.png', wx.BITMAP_TYPE_PNG), u"Adicionar", pos=(0, 0), size=(100, 40)) button_add_product.Bind(wx.EVT_BUTTON, self.data_insert, id=220) button_product_editor = GenBitmapTextButton( self.__panel_product, 221, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u'Editar', pos=(100, 0), size=(100, 40)) button_product_editor.Bind(wx.EVT_BUTTON, self.data_editor_enable, id=221) button_remove_product = GenBitmapTextButton( self.__panel_product, 222, wx.Bitmap(core.directory_paths['icons'] + 'Trash.png', wx.BITMAP_TYPE_PNG), u'Apagar', pos=(200, 0), size=(100, 40)) button_remove_product.Bind(wx.EVT_BUTTON, self.data_delete, id=222) bottom = wx.Panel(self, -1, size=(450, 50), pos=(10, 590), style=wx.SIMPLE_BORDER) add = GenBitmapTextButton( bottom, -1, wx.Bitmap(core.directory_paths['icons'] + 'Add.png', wx.BITMAP_TYPE_PNG), u'Registrar produtos', size=(200, 50), pos=(0, 0)) reset = GenBitmapTextButton( bottom, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), u'Recomeçar', size=(125, 50), pos=(200, 0)) cancel = GenBitmapTextButton( bottom, -1, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png', wx.BITMAP_TYPE_PNG), u'Sair', size=(125, 50), pos=(325, 0)) add.Bind(wx.EVT_BUTTON, self.ask_end) reset.Bind(wx.EVT_BUTTON, self.ask_clean) cancel.Bind(wx.EVT_BUTTON, self.ask_exit) self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND)
def setup_gui(self): self.SetPosition(wx.Point(100, 100)) self.SetSize(wx.Size(1200, 550)) self.SetIcon((wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO))) self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) panel_top = wx.Panel(self, pos=(10, 10), size=(1180, 100)) button_categories = GenBitmapTextButton( panel_top, -1, wx.Bitmap(core.directory_paths['icons'] + 'Drawer.png', wx.BITMAP_TYPE_PNG), u'Categorias', pos=(5, 40), size=(115, 40), style=wx.SIMPLE_BORDER) button_categories.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) button_categories.Bind(wx.EVT_BUTTON, self.open_category_manager) panel_buttons_left = wx.Panel(panel_top, pos=(140, 40), size=(500, 40), style=wx.SIMPLE_BORDER) see = GenBitmapTextButton( panel_buttons_left, -1, wx.Bitmap(core.directory_paths['icons'] + 'Search.png', wx.BITMAP_TYPE_PNG), u'Ver Mais', pos=(0, 0), size=(100, 40)) see.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) see.Bind(wx.EVT_BUTTON, self.data_open) plus = GenBitmapTextButton( panel_buttons_left, -1, wx.Bitmap(core.directory_paths['icons'] + 'contact-new.png', wx.BITMAP_TYPE_PNG), u'Novo', pos=(100, 0), size=(100, 40)) plus.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) plus.Bind(wx.EVT_BUTTON, self.open_new_product) mplus = GenBitmapTextButton( panel_buttons_left, -1, wx.Bitmap(core.directory_paths['icons'] + 'Box_download.png', wx.BITMAP_TYPE_PNG), u'Entrada', pos=(200, 0), size=(100, 40)) mplus.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) mplus.Bind(wx.EVT_BUTTON, self.open_update_inventory) edi = GenBitmapTextButton( panel_buttons_left, -1, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u'Editar', pos=(300, 0), size=(100, 40)) edi.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) edi.Bind(wx.EVT_BUTTON, self.data_edit) era = GenBitmapTextButton( panel_buttons_left, -1, wx.Bitmap(core.directory_paths['icons'] + 'Trash.png', wx.BITMAP_TYPE_PNG), u'Apagar', pos=(400, 0), size=(100, 40)) era.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) era.Bind(wx.EVT_BUTTON, self.ask_delete) self.textbox_filter = wx.SearchCtrl(panel_top, -1, pos=(665, 45), size=(200, 30), style=wx.TE_PROCESS_ENTER) self.textbox_filter.SetDescriptiveText(u'Busca por nome') self.textbox_filter.ShowCancelButton(True) fin = wx.BitmapButton(panel_top, -1, wx.Bitmap(core.directory_paths['icons'] + 'edit_find.png'), pos=(870, 42), size=(35, 35), style=wx.NO_BORDER) fin.Bind(wx.EVT_BUTTON, self.database_search) fin.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.textbox_filter.Bind(wx.EVT_TEXT_ENTER, self.database_search) self.textbox_filter.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.database_search) self.textbox_filter.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.clean) panel_buttons_right = wx.Panel(panel_top, pos=(930, 40), size=(240, 40), style=wx.SIMPLE_BORDER) quir = GenBitmapTextButton(panel_buttons_right, -1, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png'), u'Sair', pos=(120, 0), size=(120, 40)) quir.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) quir.Bind(wx.EVT_BUTTON, self.exit) rep = GenBitmapTextButton(panel_buttons_right, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png'), u'Atualizar', pos=(0, 0), size=(120, 40)) rep.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) rep.Bind(wx.EVT_BUTTON, self.setup) panel_center = wx.Panel(self, -1, pos=(10, 110), size=(1180, 410)) self.list_products = wx.ListCtrl(panel_center, -1, pos=(5, 5), size=(1170, 390), style=wx.LC_VRULES | wx.LC_HRULES | wx.SIMPLE_BORDER | wx.LC_REPORT) self.list_products.InsertColumn(0, u'Descrição do produto', width=400) self.list_products.InsertColumn(1, u'ID', width=50) self.list_products.InsertColumn(2, u'Categoria', width=150) self.list_products.InsertColumn(3, u'Preço', width=200) self.list_products.InsertColumn(4, u'Estoque', width=180) self.list_products.InsertColumn(5, u'Vendidos', width=100) self.list_products.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.data_open)
def setup_gui(self): self.SetSize(wx.Size(500, 410)) self.SetIcon((wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO))) self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.Centre() self.panel_data = wx.Panel(self, -1, pos=(0, 0), size=(500, 320), style=wx.TAB_TRAVERSAL) wx.StaticText(self.panel_data, -1, u'Descrição do produto:', pos=(190, 10)) wx.StaticText(self.panel_data, -1, u'Código de Barras:', pos=(190, 70)) wx.StaticText(self.panel_data, -1, u'Preço:', pos=(190, 130)) wx.StaticText(self.panel_data, -1, u'Estoque:', pos=(350, 130)) wx.StaticText(self.panel_data, -1, u'Categoria:', pos=(190, 190)) wx.StaticText(self.panel_data, -1, u'Fornecedor:', pos=(350, 190)) wx.StaticText(self.panel_data, -1, u'Observações:', pos=(10, 230)) self.textbox_description = wx.TextCtrl(self.panel_data, -1, pos=(190, 30), size=(300, 30)) self.textbox_barcode = wx.TextCtrl(self.panel_data, -1, pos=(190, 90), size=(300, 30)) self.textbox_price = wx.TextCtrl(self.panel_data, -1, pos=(190, 150), size=(100, 30)) self.textbox_amount = wx.TextCtrl(self.panel_data, -1, pos=(350, 150), size=(100, 30)) self.textbox_price.Bind(wx.EVT_CHAR, core.check_currency) self.textbox_barcode.Bind(wx.EVT_CHAR, core.check_number) if not self.editable: self.combobox_category = wx.TextCtrl(self.panel_data, -1, pos=(190, 210), size=(150, 30)) else: self.combobox_category = wx.ComboBox(self.panel_data, -1, pos=(190, 210), size=(150, 30), style=wx.TE_READONLY) self.textbox_supplier = wx.TextCtrl(self.panel_data, -1, pos=(350, 210), size=(140, 30)) self.textbox_observation = wx.TextCtrl(self.panel_data, -1, pos=(10, 250), size=(480, 65), style=wx.TE_MULTILINE) self.panel_image = wx.Panel(self.panel_data, -1, size=(150, 150), pos=(10, 45), style=wx.SIMPLE_BORDER) self.panel_image.SetBackgroundColour('#ffffff') wx.EVT_PAINT(self.panel_image, self.OnPaint) panel_bottom = wx.Panel(self, -1, pos=(0, 325), size=(500, 50)) if not self.editable: panel_bottom_buttons = wx.Panel(panel_bottom, pos=(150, 5), size=(200, 40), style=wx.SIMPLE_BORDER) edipo = GenBitmapTextButton( panel_bottom_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u"Editar", pos=(0, 0), size=(100, 40)) edipo.Bind(wx.EVT_BUTTON, self.set_editable) cancel = GenBitmapTextButton( panel_bottom_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png', wx.BITMAP_TYPE_PNG), u"Sair", pos=(100, 0), size=(100, 40)) cancel.Bind(wx.EVT_BUTTON, self.ask_exit) self.combobox_category.Disable() self.textbox_description.Disable() self.textbox_barcode.Disable() self.textbox_price.Disable() self.textbox_amount.Disable() self.textbox_supplier.Disable() self.textbox_observation.Disable() else: panel_bottom_buttons = wx.Panel(panel_bottom, pos=(90, 5), size=(320, 40), style=wx.SIMPLE_BORDER) finish = GenBitmapTextButton( panel_bottom_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Check.png', wx.BITMAP_TYPE_PNG), u"Finalizar", pos=(0, 0), size=(100, 40)) finish.Bind(wx.EVT_BUTTON, self.ask_end) restart = GenBitmapTextButton( panel_bottom_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), u"Recomeçar", pos=(100, 0), size=(120, 40)) restart.Bind(wx.EVT_BUTTON, self.ask_clean) cancel = GenBitmapTextButton( panel_bottom_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png', wx.BITMAP_TYPE_PNG), u"Sair", pos=(220, 0), size=(100, 40)) cancel.Bind(wx.EVT_BUTTON, self.ask_exit) self.clean()
def __init__(self): """ Initialize the dialog """ wx.Dialog.__init__(self, None, wx.ID_ANY, 'Preferences', size=(550, 400)) appPath = controller.appPath # Create widgets font = wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD) serverLbl = wx.StaticText(self, label="Update Server:") self.serverTxt = wx.TextCtrl(self) self.serverTxt.Disable() usernameLbl = wx.StaticText(self, label="Username:"******"Password:"******"Update Interval:") self.updateTxt = wx.TextCtrl(self) minutesLbl = wx.StaticText(self, label="minutes") agencyLbl = wx.StaticText(self, label="Agency Filter:") choices = [ "Include all agencies except", "Exclude all agencies except" ] self.agencyCbo = wx.ComboBox(self, value="Include all agencies except", choices=choices, style=wx.CB_DROPDOWN | wx.CB_READONLY) self.agencyCbo.SetFont(font) self.filterTxt = wx.TextCtrl(self, wx.ID_ANY, "") img = wx.Bitmap(r"%s/images/filesave.png" % appPath) saveBtn = GenBitmapTextButton(self, wx.ID_ANY, img, "Save", size=(110, 50)) saveBtn.Bind(wx.EVT_BUTTON, self.savePreferences) cancelBtn = CloseBtn(self, label="Cancel") cancelBtn.Bind(wx.EVT_BUTTON, self.onCancel) # Set the widgets font widgets = [ serverLbl, usernameLbl, passwordLbl, updateLbl, agencyLbl, minutesLbl, self.serverTxt, self.usernameTxt, self.passwordTxt, self.updateTxt, self.agencyCbo, self.filterTxt, saveBtn, cancelBtn ] for widget in widgets: widget.SetFont(font) # layout widgets mainSizer = wx.BoxSizer(wx.VERTICAL) updateSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer = wx.BoxSizer(wx.HORIZONTAL) prefSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) prefSizer.AddGrowableCol(1) prefSizer.Add(serverLbl, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) prefSizer.Add(self.serverTxt, 0, wx.EXPAND) prefSizer.Add(usernameLbl, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) prefSizer.Add(self.usernameTxt, 0, wx.EXPAND) prefSizer.Add(passwordLbl, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) prefSizer.Add(self.passwordTxt, 0, wx.EXPAND) prefSizer.Add(updateLbl, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) updateSizer.Add(self.updateTxt, 0, wx.RIGHT, 5) updateSizer.Add(minutesLbl, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) prefSizer.Add(updateSizer) prefSizer.Add(agencyLbl, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) prefSizer.Add(self.agencyCbo, 0, wx.EXPAND) prefSizer.Add((20, 20)) prefSizer.Add(self.filterTxt, 0, wx.EXPAND) mainSizer.Add(prefSizer, 0, wx.EXPAND | wx.ALL, 5) btnSizer.Add(saveBtn, 0, wx.ALL, 5) btnSizer.Add(cancelBtn, 0, wx.ALL, 5) mainSizer.Add(btnSizer, 0, wx.ALL | wx.ALIGN_RIGHT, 10) self.SetSizer(mainSizer) # load preferences self.loadPreferences()
def __init__(self, parent): """Constructor""" self.panel = wx.Panel.__init__(self, parent=parent) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) compilerList = ['SDCC', 'XC8'] devicesList = [ '16f1459', '18f13k50', '18f14k50', '18f2455', '18f2550', '18f25k50', '18f26j50', '18f26j53', '18f27j53', '18f4455', '18f4550', '18f45k50', '18f46j50', '18f46j53', '18f47j53' ] oscillatorList = [ '4', '8', '12', '16', '20', '24', '40', '48', 'INTOSC' ] optionsList = [ "String Descriptor", "Low Speed USB", "Low Voltage Programming", "Ext. 32768Hz Oscillator", "Watchdog Enabled" ] buttonsList = [ ('img/runw.png', 'Compile the bootloader code source', self.OnCompile), ('img/board.png', 'Program (ICSP) the bootloader on the chip', self.OnProgram), ('img/open.png', 'Open a Hex file', self.OnOpen), ('img/dwn.png', 'Upload a Hex File on the Chip with the bootloader\'s help', self.OnUpload), ('img/help.png', 'Get some explanations', self.OnHelp), ('img/exit.png', 'Quit Wiztiti program', self.OnQuit) ] sizerList = [] # list of all sizers # -------------------------------------------------------------- # Compiler # -------------------------------------------------------------- CmpBox = wx.StaticBox(self, -1, label=u'Compiler ') boldfont = CmpBox.GetFont() boldfont.SetWeight(wx.BOLD) CmpBox.SetFont(boldfont) sizerList.append(wx.StaticBoxSizer(CmpBox, wx.VERTICAL)) # Create CheckBoxes for each supported processor old_col = 0 grid = [] grid.append(wx.BoxSizer(wx.HORIZONTAL)) self.checkboxCmpList = [] for i in range(len(compilerList)): # list of all checkboxes self.checkboxCmpList.append( wx.CheckBox(self, id=i, label=compilerList[i])) new_col = i / 5 if (new_col > old_col): old_col = new_col grid.append(wx.BoxSizer(wx.HORIZONTAL)) grid[-1].Add(self.checkboxCmpList[-1], 0, wx.ALL | wx.EXPAND, 5) for i in range(len(grid)): sizerList[-1].Add(grid[i], 0, wx.ALL | wx.EXPAND, 5) # -------------------------------------------------------------- # Microcontroller # -------------------------------------------------------------- DevBox = wx.StaticBox(self, -1, label=u'PIC Microcontroller Target ') boldfont = DevBox.GetFont() boldfont.SetWeight(wx.BOLD) DevBox.SetFont(boldfont) sizerList.append(wx.StaticBoxSizer(DevBox, wx.VERTICAL)) # Create CheckBoxes for each supported processor old_col = 0 grid = [] grid.append(wx.BoxSizer(wx.HORIZONTAL)) self.checkboxDevList = [] for i in range(len(devicesList)): # list of all checkboxes self.checkboxDevList.append( wx.CheckBox(self, id=i, label=devicesList[i])) new_col = i / 5 if (new_col > old_col): old_col = new_col grid.append(wx.BoxSizer(wx.HORIZONTAL)) grid[-1].Add(self.checkboxDevList[-1], 0, wx.ALL | wx.EXPAND, 5) for i in range(len(grid)): sizerList[-1].Add(grid[i], 0, wx.ALL | wx.EXPAND, 5) # -------------------------------------------------------------- # Oscillator # -------------------------------------------------------------- OscBox = wx.StaticBox(self, -1, label=u'Oscillator\'s Frequency (MHz)') boldfont = OscBox.GetFont() boldfont.SetWeight(wx.BOLD) OscBox.SetFont(boldfont) sizerList.append(wx.StaticBoxSizer(OscBox, wx.VERTICAL)) old_col = 0 grid = [] grid.append(wx.BoxSizer(wx.HORIZONTAL)) self.checkboxOscList = [] for i in range(len(oscillatorList)): # list of all checkboxes self.checkboxOscList.append( wx.CheckBox(self, id=i, label=oscillatorList[i])) new_col = i / 8 if (new_col > old_col): old_col = new_col grid.append(wx.BoxSizer(wx.HORIZONTAL)) grid[-1].Add(self.checkboxOscList[-1], 0, wx.ALL | wx.EXPAND, 5) for i in range(len(grid)): sizerList[-1].Add(grid[i], 0, wx.ALL | wx.EXPAND, 5) # -------------------------------------------------------------- # Options # -------------------------------------------------------------- OptBox = wx.StaticBox(self, -1, label=u'Options') boldfont = OptBox.GetFont() boldfont.SetWeight(wx.BOLD) OptBox.SetFont(boldfont) sizerList.append(wx.StaticBoxSizer(OptBox, wx.VERTICAL)) old_col = 0 grid = [] grid.append(wx.BoxSizer(wx.HORIZONTAL)) self.checkboxOptList = [] for i in range(len(optionsList)): # list of all checkboxes self.checkboxOptList.append( wx.CheckBox(self, id=i, label=optionsList[i])) new_col = i / 2 if (new_col > old_col): old_col = new_col grid.append(wx.BoxSizer(wx.HORIZONTAL)) grid[-1].Add(self.checkboxOptList[-1], 0, wx.ALL | wx.EXPAND, 5) for i in range(len(grid)): sizerList[-1].Add(grid[i], 0, wx.ALL | wx.EXPAND, 5) # -------------------------------------------------------------- # Buttons # -------------------------------------------------------------- ButBox = wx.StaticBox(self, -1, label=u'Actions') boldfont = OptBox.GetFont() boldfont.SetWeight(wx.BOLD) ButBox.SetFont(boldfont) sizerList.append(wx.StaticBoxSizer(ButBox, wx.VERTICAL)) old_col = 0 grid = [] grid.append(wx.BoxSizer(wx.HORIZONTAL)) self.butList = [] for i in range(len(buttonsList)): # list of all buttons img, lab, event = buttonsList[i] b = GenBitmapTextButton(self, i, wx.Bitmap(img), label="", size=(48, 48)) b.SetBezelWidth(1) b.SetBackgroundColour('#DDDDDD') #b.SetHelpText(lab) b.SetToolTipString(lab) # Catch events b.Bind(wx.EVT_BUTTON, event) b.Bind(wx.EVT_ENTER_WINDOW, self.OnButtonEnter) b.Bind(wx.EVT_LEAVE_WINDOW, self.OnButtonLeave) self.butList.append(b) new_col = i / 6 if (new_col > old_col): old_col = new_col grid.append(wx.BoxSizer(wx.HORIZONTAL)) grid[-1].Add(self.butList[-1], 0, wx.ALL | wx.EXPAND, 5) for i in range(len(grid)): sizerList[-1].Add(grid[i], 0, wx.ALL | wx.EXPAND, 5) # -------------------------------------------------------------- # Sizer # -------------------------------------------------------------- topSizer = wx.BoxSizer(wx.VERTICAL) for i in range(len(sizerList)): topSizer.Add(sizerList[i], 0, wx.ALL | wx.EXPAND, 5) self.SetSizerAndFit(topSizer) self.Show(True)
def setup_gui(self): self.Centre() self.SetIcon(wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO)) self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) # first first = wx.Panel(self, -1, size=(450, 230), pos=(10, 10), style=wx.SIMPLE_BORDER | wx.TAB_TRAVERSAL) first.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.textbox_description = wx.SearchCtrl(first, -1, pos=(10, 10), size=(430, 30)) self.textbox_description.Bind(wx.EVT_TEXT, self.database_search) self.textbox_description.ShowSearchButton(True) self.textbox_description.SetDescriptiveText(u'Busca de produto') self.list_inventory = wx.ListCtrl(first, -1, pos=(10, 45), size=(430, 115), style=wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.SIMPLE_BORDER) self.list_inventory.InsertColumn(0, u'Descrição', width=230) self.list_inventory.InsertColumn(1, u'Estoque') self.list_inventory.InsertColumn(2, u'Preço') self.list_inventory.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.database_select) wx.StaticText(first, -1, u"ID: *", pos=(50, 170)) self.textbox_id = wx.TextCtrl(first, -1, pos=(50, 190), size=(150, 30)) self.textbox_id.Bind(wx.EVT_CHAR, core.check_number) wx.StaticText(first, -1, u"Quantidade: *", pos=(250, 170)) self.textbox_amount = wx.TextCtrl(first, -1, pos=(250, 190), size=(150, 30)) self.textbox_product_unit = wx.TextCtrl(first, -1, pos=(405, 195), size=(30, -1), style=wx.NO_BORDER | wx.TE_READONLY) self.textbox_product_unit.SetBackgroundColour( core.COLOR_DEFAULT_BACKGROUND) # last last = wx.Panel(self, -1, size=(140, 230), pos=(470, 10), style=wx.SIMPLE_BORDER) last.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) last_ = wx.Panel(last, pos=(10, 55), size=(120, 120), style=wx.SIMPLE_BORDER) finish = GenBitmapTextButton( last_, -1, wx.Bitmap(core.directory_paths['icons'] + 'Check.png', wx.BITMAP_TYPE_PNG), u'Finalizar', pos=(0, 0), size=(120, 40)) finish.Bind(wx.EVT_BUTTON, self.ask_end) restart = GenBitmapTextButton( last_, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), u'Recomeçar', pos=(0, 40), size=(120, 40)) restart.Bind(wx.EVT_BUTTON, self.ask_clean) cancel = GenBitmapTextButton( last_, -1, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png', wx.BITMAP_TYPE_PNG), u"sair", pos=(0, 80), size=(120, 40)) cancel.Bind(wx.EVT_BUTTON, self.ask_exit)
def setup_gui(self): self.SetPosition(wx.Point(100, 100)) self.SetSize(wx.Size(1140, 560)) self.SetIcon((wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO))) self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) panel_top = wx.Panel(self, pos=(10, 10), size=(1120, 100)) button_categories = GenBitmapTextButton( panel_top, -1, wx.Bitmap(core.directory_paths['icons'] + 'Drawer.png', wx.BITMAP_TYPE_PNG), u'Categorias', pos=(5, 40), size=(115, 40), style=wx.SIMPLE_BORDER) button_categories.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) button_categories.Bind(wx.EVT_BUTTON, self.open_category_manager) button_payment = GenBitmapTextButton( panel_top, -1, wx.Bitmap(core.directory_paths['icons'] + 'Check.png', wx.BITMAP_TYPE_PNG), u'Pagamento Realizado', pos=(140, 40), size=(160, 40), style=wx.SIMPLE_BORDER) button_payment.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) button_payment.Bind(wx.EVT_BUTTON, self.data_edit_payment) panel_buttons_left = wx.Panel(panel_top, pos=(320, 40), size=(400, 40), style=wx.SIMPLE_BORDER) see = GenBitmapTextButton( panel_buttons_left, -1, wx.Bitmap(core.directory_paths['icons'] + 'Search.png', wx.BITMAP_TYPE_PNG), u'Ver Mais', pos=(0, 0), size=(100, 40)) see.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) see.Bind(wx.EVT_BUTTON, self.data_open) plus = GenBitmapTextButton( panel_buttons_left, -1, wx.Bitmap(core.directory_paths['icons'] + 'contact-new.png', wx.BITMAP_TYPE_PNG), u'Novo', pos=(100, 0), size=(100, 40)) plus.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) plus.Bind(wx.EVT_BUTTON, self.open_new_transaction) edi = GenBitmapTextButton( panel_buttons_left, -1, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u'Editar', pos=(200, 0), size=(100, 40)) edi.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) edi.Bind(wx.EVT_BUTTON, self.data_edit) era = GenBitmapTextButton( panel_buttons_left, -1, wx.Bitmap(core.directory_paths['icons'] + 'Trash.png', wx.BITMAP_TYPE_PNG), u'Apagar', pos=(300, 0), size=(100, 40)) era.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) era.Bind(wx.EVT_BUTTON, self.ask_delete) self.combobox_month_displayed = wx.ComboBox(panel_top, -1, pos=(745, 45), size=(100, 30), style=wx.CB_READONLY) self.combobox_month_displayed.Bind(wx.EVT_TEXT_ENTER, self.setup) panel_buttons_right = wx.Panel(panel_top, pos=(870, 40), size=(240, 40), style=wx.SIMPLE_BORDER) quir = GenBitmapTextButton(panel_buttons_right, -1, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png'), u'Sair', pos=(120, 0), size=(120, 40)) quir.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) quir.Bind(wx.EVT_BUTTON, self.exit) rep = GenBitmapTextButton(panel_buttons_right, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png'), u'Atualizar', pos=(0, 0), size=(120, 40)) rep.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) rep.Bind(wx.EVT_BUTTON, self.setup) self.notebook_lists = wx.Notebook(self, -1, pos=(15, 110), size=(1110, 410)) self.notebook_lists.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) for i in range(2): list_transactions = wx.ListCtrl(self.notebook_lists, -1, style=wx.LC_VRULES | wx.LC_HRULES | wx.SIMPLE_BORDER | wx.LC_REPORT) list_transactions.InsertColumn(0, u'Descrição', width=400) list_transactions.InsertColumn(1, u'ID', width=90) list_transactions.InsertColumn(2, u'Categoria', width=250) list_transactions.InsertColumn(3, u'Valor', width=110) list_transactions.InsertColumn(4, u'Data', width=120) list_transactions.InsertColumn(5, u'Pagamento', width=130) list_transactions.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.data_open) if not i: self.list_expenses = list_transactions text = u'Contas e Gastos' else: self.list_incomes = list_transactions text = u'Ganhos e Entradas' self.notebook_lists.AddPage(list_transactions, text)
def setup_gui(self): self.Centre() self.SetIcon(wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO)) self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) # first first = wx.Panel(self, -1, size=(495, 250), pos=(10, 10), style=wx.SIMPLE_BORDER | wx.TAB_TRAVERSAL) first.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) wx.StaticText(first, -1, u"Descrição: *", pos=(20, 20)) self.textbox_description = wx.TextCtrl(first, -1, pos=(20, 40), size=(200, 30)) wx.StaticText(first, -1, u"Categoria:", pos=(20, 90)) self.combobox_category = wx.ComboBox(first, -1, pos=(20, 110), size=(165, 30), style=wx.CB_READONLY) self.update_categories() button_category = wx.BitmapButton( first, -1, wx.Bitmap(core.directory_paths['icons'] + 'Add.png', wx.BITMAP_TYPE_PNG), pos=(185, 105), size=(32, 32), style=wx.NO_BORDER) button_category.Bind(wx.EVT_BUTTON, self.open_category_register) button_category.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) wx.StaticText(first, -1, u"Valor: *", pos=(20, 160)) self.textbox_value = wx.TextCtrl(first, -1, pos=(20, 180), size=(200, 30)) self.textbox_value.Bind(wx.EVT_CHAR, core.check_currency) self.textbox_value.SetValue(u'R$ 0,00') wx.StaticText(first, -1, u"Data da Transação: *", pos=(240, 35)) self.calendar_date = wx.calendar.CalendarCtrl( first, -1, wx.DateTime_Now(), pos=(240, 55), style=wx.calendar.CAL_SHOW_HOLIDAYS | wx.calendar.CAL_SEQUENTIAL_MONTH_SELECTION | wx.calendar.CAL_BORDER_ROUND | wx.SIMPLE_BORDER) self.checkbox_payed = wx.CheckBox(first, -1, u'Pagamento Realizado? ', pos=(200, 220), size=(-1, -1), style=wx.ALIGN_LEFT) self.checkbox_payed.SetFont(wx.Font(-1, wx.SWISS, wx.NORMAL, wx.BOLD)) self.Bind(wx.EVT_CHECKBOX, self.checkbox_change, self.checkbox_payed) self.checkbox_payed.SetForegroundColour(wx.BLUE) self.checkbox_payed.SetValue(True) self.checkbox_payed.SetSize((160, -1)) # last last = wx.Panel(self, -1, size=(130, 250), pos=(515, 10), style=wx.SIMPLE_BORDER) last.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) if self.editable: last_ = wx.Panel(last, pos=(5, 65), size=(120, 120), style=wx.SIMPLE_BORDER) finish = GenBitmapTextButton( last_, -1, wx.Bitmap(core.directory_paths['icons'] + 'Check.png', wx.BITMAP_TYPE_PNG), u'Finalizar', pos=(0, 0), size=(120, 40)) finish.Bind(wx.EVT_BUTTON, self.ask_end) restart = GenBitmapTextButton( last_, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), u'Recomeçar', pos=(0, 40), size=(120, 40)) restart.Bind(wx.EVT_BUTTON, self.ask_clean) cancel = GenBitmapTextButton( last_, -1, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png', wx.BITMAP_TYPE_PNG), u"sair", pos=(0, 80), size=(120, 40)) cancel.Bind(wx.EVT_BUTTON, self.ask_exit) else: self.textbox_description.Disable() self.textbox_value.Disable() self.combobox_category.Disable() self.calendar_date.Disable() self.checkbox_payed.Disable() last_ = wx.Panel(last, pos=(5, 85), size=(120, 80), style=wx.SIMPLE_BORDER) edit = GenBitmapTextButton( last_, 243, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u"Editar", pos=(0, 0), size=(120, 40)) edit.Bind(wx.EVT_BUTTON, self.open_transaction_edit) cancel = GenBitmapTextButton( last_, 242, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png', wx.BITMAP_TYPE_PNG), u"Sair", pos=(0, 40), size=(120, 40)) cancel.Bind(wx.EVT_BUTTON, self.exit)
def setup_gui(self): self.SetPosition(wx.Point(75, 0)) self.SetSize(wx.Size(1240, 720)) self.SetIcon(wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO)) self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) # first self.panel_top = wx.Panel(self, -1, pos=(10, 5), size=(1220, 50), style=wx.TAB_TRAVERSAL) self.panel_top.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) static_text_fechamento = wx.StaticText(self.panel_top, -1, u"Fechamento de:", pos=(300, 15)) static_text_fechamento.SetFont(wx.Font(11, wx.SWISS, wx.NORMAL, wx.BOLD)) self.setup_options() panel_top_buttons = wx.Panel(self.panel_top, -1, pos=(750, 5), size=(440, 40), style=wx.TAB_TRAVERSAL | wx.SIMPLE_BORDER) fupdate = GenBitmapTextButton(panel_top_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), u'Atualizar janela', pos=(0, 0), size=(140, 40)) fupdate.Bind(wx.EVT_BUTTON, self.reopen) pol = GenBitmapTextButton(panel_top_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Tools.png', wx.BITMAP_TYPE_PNG), u"Recuperação de registros", pos=(140, 0), size=(200, 40)) pol.Bind(wx.EVT_BUTTON, self.open_record_editor) button_save = GenBitmapTextButton(panel_top_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Save.png', wx.BITMAP_TYPE_PNG), u"Salvar", pos=(340, 0), size=(100, 40)) button_save.Bind(wx.EVT_BUTTON, self.save) # Painel das vendas panel1 = wx.Panel(self, -1, pos=(10, 65), size=(810, 260), style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL) panel1.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.list_sales = wx.gizmos.TreeListCtrl(panel1, -1, pos=(10, 5), size=(620, 250), style=wx.SIMPLE_BORDER | wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT) self.list_sales.AddColumn(u"Descrição", width=250) self.list_sales.AddColumn(u"Quantidade", width=90) self.list_sales.AddColumn(u"Pagamento", width=150) self.list_sales.AddColumn(u"Valor", width=120) self.list_sales.SetMainColumn(0) panel1b = wx.Panel(panel1, pos=(650, 50), size=(145, 160), style=wx.SIMPLE_BORDER) plus = GenBitmapTextButton(panel1b, -1, wx.Bitmap(core.directory_paths['icons'] + 'Add.png', wx.BITMAP_TYPE_PNG), u"Nova venda", pos=(0, 0), size=(145, 40)) plus.Bind(wx.EVT_BUTTON, self.open_sale_register) edit = GenBitmapTextButton(panel1b, -1, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u"Editar venda", pos=(0, 40), size=(145, 40)) edit.Bind(wx.EVT_BUTTON, self.open_sale_edit) remove = GenBitmapTextButton(panel1b, -1, wx.Bitmap(core.directory_paths['icons'] + 'Trash.png', wx.BITMAP_TYPE_PNG), u'Apagar venda', pos=(0, 80), size=(145, 40)) remove.Bind(wx.EVT_BUTTON, self.ask_delete_sale) update = GenBitmapTextButton(panel1b, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), u'Atualizar', pos=(0, 120), size=(145, 40)) update.Bind(wx.EVT_BUTTON, self.setup) # Painel dos gastos panel2 = wx.Panel(self, 53, pos=(10, 335), size=(810, 170), style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL) panel2.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.list_expenses = wx.gizmos.TreeListCtrl(panel2, -1, pos=(10, 5), size=(620, 160), style=wx.SIMPLE_BORDER | wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT) self.list_expenses.AddColumn(u"Data/Horário", width=130) self.list_expenses.AddColumn(u"Descrição", width=280) self.list_expenses.AddColumn(u"Quantidade", width=90) self.list_expenses.AddColumn(u"Valor", width=110) self.list_expenses.SetMainColumn(0) panel2b = wx.Panel(panel2, pos=(650, 5), size=(145, 160), style=wx.SIMPLE_BORDER) splus = GenBitmapTextButton(panel2b, -1, wx.Bitmap(core.directory_paths['icons'] + 'Add.png', wx.BITMAP_TYPE_PNG), u'Adicionar gasto', pos=(0, 0), size=(145, 40)) splus.Bind(wx.EVT_BUTTON, self.open_expense_register) sedit = GenBitmapTextButton(panel2b, -1, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u'Editar gasto', pos=(0, 40), size=(145, 40)) sedit.Bind(wx.EVT_BUTTON, self.open_expense_edit) sremove = GenBitmapTextButton(panel2b, -1, wx.Bitmap(core.directory_paths['icons'] + 'Trash.png', wx.BITMAP_TYPE_PNG), u'Apagar gasto', pos=(0, 80), size=(145, 40)) sremove.Bind(wx.EVT_BUTTON, self.ask_delete_expense) supdate = GenBitmapTextButton(panel2b, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), u'Atualizar', pos=(0, 120), size=(145, 40)) supdate.Bind(wx.EVT_BUTTON, self.setup) # Painel dos desperdicios panel_last = wx.Panel(self, 56, pos=(10, 515), size=(810, 170), style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL) panel_last.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.list_wastes = wx.gizmos.TreeListCtrl(panel_last, -1, pos=(10, 5), size=(620, 160), style=wx.SIMPLE_BORDER | wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT) self.list_wastes.AddColumn(u"Descrição", width=280) self.list_wastes.AddColumn(u"Quantidade", width=90) self.list_wastes.AddColumn(u"Valor", width=110) self.list_wastes.SetMainColumn(0) panel_last_buttons = wx.Panel(panel_last, pos=(650, 5), size=(145, 160), style=wx.SIMPLE_BORDER) wplus = GenBitmapTextButton(panel_last_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Add.png', wx.BITMAP_TYPE_PNG), u'Adicionar registro', pos=(0, 0), size=(145, 40)) wplus.Bind(wx.EVT_BUTTON, self.open_waste_register) wedit = GenBitmapTextButton(panel_last_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u'Editar registro', pos=(0, 40), size=(145, 40)) wedit.Bind(wx.EVT_BUTTON, self.open_waste_edit) wremove = GenBitmapTextButton(panel_last_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Trash.png', wx.BITMAP_TYPE_PNG), u'Apagar registro', pos=(0, 80), size=(145, 40)) wremove.Bind(wx.EVT_BUTTON, self.ask_delete_waste) wupdate = GenBitmapTextButton(panel_last_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), 'Atualizar', pos=(0, 120), size=(145, 40)) wupdate.Bind(wx.EVT_BUTTON, self.setup, wupdate) self.available_lists = [self.list_sales, self.list_expenses, self.list_wastes] # Painel com o resulmo do dia panel3 = wx.Panel(self, -1, pos=(830, 65), size=(400, 620), style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL) panel3.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) part1 = wx.Panel(panel3, -1, pos=(5, 50), size=(390, 265), style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL) part2 = wx.Panel(panel3, -1, pos=(5, 320), size=(390, 85), style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL) part3 = wx.Panel(panel3, -1, pos=(5, 410), size=(390, 200), style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL) static_money_texts = [] static_number_texts = [] self.textbox_day_total = wx.TextCtrl(panel3, -1, "0,00", pos=(315, 10), size=(70, 30), style=wx.TE_READONLY) self.textbox_sales_value = wx.TextCtrl(part1, -1, "0,00", pos=(310, 5), size=(70, 30), style=wx.TE_READONLY) self.textbox_sales_amount = wx.TextCtrl(part1, -1, "0", pos=(310, 50), size=(70, 30), style=wx.TE_READONLY) self.textbox_money_value = wx.TextCtrl(part1, -1, "0,00", pos=(310, 95), size=(70, 30), style=wx.TE_READONLY) self.textbox_money_amount = wx.TextCtrl(part1, -1, "0", pos=(310, 140), size=(70, 30), style=wx.TE_READONLY) self.textbox_card_value = wx.TextCtrl(part1, -1, "0,00", pos=(310, 185), size=(70, 30), style=wx.TE_READONLY) self.textbox_card_amount = wx.TextCtrl(part1, -1, "0", pos=(310, 230), size=(70, 30), style=wx.TE_READONLY) self.textbox_spent_value = wx.TextCtrl(part2, -1, "0,00", pos=(310, 5), size=(70, 30), style=wx.TE_READONLY) self.textbox_spent_amount = wx.TextCtrl(part2, -1, "0", pos=(310, 50), size=(70, 30), style=wx.TE_READONLY) self.textbox_cash_previous = wx.TextCtrl(part3, -1, "0,00", pos=(310, 5), size=(70, 30)) self.textbox_cash_ideal = wx.TextCtrl(part3, -1, "0,00", pos=(310, 45), size=(70, 30), style=wx.TE_READONLY) self.textbox_cash_real = wx.TextCtrl(part3, -1, "0,00", pos=(310, 85), size=(70, 30)) self.textbox_cash_tomorrow = wx.TextCtrl(part3, -1, "0,00", pos=(310, 125), size=(70, 30), style=wx.TE_READONLY) self.textbox_cash_removed = wx.TextCtrl(part3, -1, "0,00", pos=(310, 165), size=(70, 30)) self.textbox_day_total.Disable() self.textbox_sales_value.Disable() self.textbox_sales_amount.Disable() self.textbox_money_value.Disable() self.textbox_money_amount.Disable() self.textbox_card_value.Disable() self.textbox_card_amount.Disable() self.textbox_spent_value.Disable() self.textbox_spent_amount.Disable() self.textbox_cash_ideal.Disable() self.textbox_cash_tomorrow.Disable() static_money_texts.append(wx.StaticText(panel3, -1, u"Total do dia", pos=(10, 17))) static_money_texts.append(wx.StaticText(part1, -1, u"Total das Vendas", pos=(5, 12))) static_number_texts.append(wx.StaticText(part1, -1, u"Quantidade de vendas", pos=(5, 57))) static_money_texts.append(wx.StaticText(part1, -1, u"Total das vendas em dinheiro", pos=(5, 102))) static_number_texts.append(wx.StaticText(part1, -1, u"Quantidade de vendas em dinheiro", pos=(5, 147))) static_money_texts.append(wx.StaticText(part1, -1, u"Total das vendas no cartão", pos=(5, 192))) static_number_texts.append(wx.StaticText(part1, -1, u"Quantidade de vendas no cartão", pos=(5, 237))) static_money_texts.append(wx.StaticText(part2, -1, u"Total de gastos", pos=(5, 12))) static_number_texts.append(wx.StaticText(part2, -1, u"Quantidade de gastos", pos=(5, 57))) static_money_texts.append(wx.StaticText(part3, -1, u"Caixa do dia anterior", pos=(5, 12))) static_money_texts.append(wx.StaticText(part3, -1, u"Caixa ideal", pos=(5, 52))) static_money_texts.append(wx.StaticText(part3, -1, u"Caixa real", pos=(5, 92))) static_money_texts.append(wx.StaticText(part3, -1, u"Caixa de amanhã", pos=(5, 132))) static_money_texts.append(wx.StaticText(part3, -1, u"Dinheiro retirado", pos=(5, 172))) self.textbox_cash_previous.Bind(wx.EVT_CHAR, core.check_money) self.textbox_cash_real.Bind(wx.EVT_CHAR, core.check_money) self.textbox_cash_removed.Bind(wx.EVT_CHAR, core.check_money) self.textbox_cash_previous.Bind(wx.EVT_TEXT, self.update_cash) self.textbox_cash_real.Bind(wx.EVT_TEXT, self.update_cash) self.textbox_cash_removed.Bind(wx.EVT_TEXT, self.update_cash) # Adiciona os pontos em cada linha com os numeros a direita para facilitar a leitura mon = self.GetTextExtent('R$')[0] dot = self.GetTextExtent('.')[0] space = 302 for box in static_money_texts: wid = box.GetSize()[0] post = box.GetPosition()[1] free = space - wid free = free - mon dots = free // dot if box is static_money_texts[0]: wx.StaticText(box.GetParent(), -1, '.' * dots + 'R$', pos=(10 + wid, post)) else: wx.StaticText(box.GetParent(), -1, '.' * dots + 'R$', pos=(5 + wid, post)) for box in static_number_texts: wid = box.GetSize()[0] post = box.GetPosition()[1] free = space - wid dots = free // dot wx.StaticText(box.GetParent(), -1, '.' * dots, pos=(5 + wid, post))
def setup_gui(self): sizer = wx.FlexGridSizer(2, 1) self.Centre() self.SetIcon(wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO)) self.notebook_settings = wx.Notebook(self, size=(800, 350), style=wx.LEFT) # --Geral-- self.page_general = GeneralPanel(self.notebook_settings) # --Notificações-- self.page_notification = NotificationPanel(self.notebook_settings) # --Security-- self.page_security = SecurityPanel(self.notebook_settings) # --SAT-- self.page_sat = SATPanel(self.notebook_settings) # --Custom-- # logo da empresa, backgrounds self.page_custom = wx.Panel(self.notebook_settings) # --Barra inferior-- panel_bottom = wx.Panel(self, size=(800, 50)) panel_buttons = wx.Panel(panel_bottom, size=(300, 40), pos=(450, 5), style=wx.SIMPLE_BORDER) button_ok = GenBitmapTextButton( panel_buttons, bitmap=wx.Bitmap(core.directory_paths['icons'] + 'Save.png'), label=u'OK', size=(100, 40), pos=(0, 0)) button_apply = GenBitmapTextButton( panel_buttons, bitmap=wx.Bitmap(core.directory_paths['icons'] + 'Check.png'), label=u'Aplicar', size=(100, 40), pos=(100, 0)) button_cancel = GenBitmapTextButton( panel_buttons, bitmap=wx.Bitmap(core.directory_paths['icons'] + 'Exit.png'), label=u'Sair', size=(100, 40), pos=(200, 0)) button_ok.Bind(wx.EVT_BUTTON, self.save_and_exit) button_apply.Bind(wx.EVT_BUTTON, self.save) button_cancel.Bind(wx.EVT_BUTTON, self.exit) # --Prepare Notbook-- self.notebook_settings.AddPage(self.page_general, u'Geral') self.notebook_settings.AddPage(self.page_security, u'Segurança') self.notebook_settings.AddPage(self.page_sat, u'SAT') self.notebook_settings.AddPage(self.page_notification, u'Notificações') self.notebook_settings.AddPage(self.page_custom, u'Customizações') sizer.Add(self.notebook_settings) sizer.Add(panel_bottom) self.SetSizer(sizer)
def setup_gui(self): self.SetSize(wx.Size(850, 585)) self.SetIcon(wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO)) self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.Centre() panel_client_intel = wx.Panel(self, -1, pos=(0, 0), size=(500, 500), style=wx.TAB_TRAVERSAL) wx.StaticText(panel_client_intel, -1, u'Nome do cliente:', pos=(190, 10)) wx.StaticText(panel_client_intel, -1, u'Sexo:', pos=(190, 70)) wx.StaticText(panel_client_intel, -1, u'Data de Nascimento:', pos=(340, 70)) wx.StaticText(panel_client_intel, -1, u'CPF:', pos=(190, 130)) wx.StaticText(panel_client_intel, -1, u'Telefone:', pos=(340, 130)) wx.StaticText(panel_client_intel, -1, u'e-mail:', pos=(10, 190)) wx.StaticText(panel_client_intel, -1, u'CEP:', pos=(340, 190)) wx.StaticText(panel_client_intel, -1, u'Estado:', pos=(10, 250)) wx.StaticText(panel_client_intel, -1, u'Cidade:', pos=(100, 250)) wx.StaticText(panel_client_intel, -1, u'Bairro:', pos=(280, 250)) wx.StaticText(panel_client_intel, -1, u'Endereço:', pos=(10, 310)) wx.StaticText(panel_client_intel, -1, u'Observações:', pos=(10, 370)) self.textbox_client_name = wx.TextCtrl(panel_client_intel, -1, pos=(190, 30), size=(300, 30)) if self.editable: self.textbox_client_sex = wx.ComboBox(panel_client_intel, -1, choices=[u'Feminino', u'Maculino'], pos=(190, 90), size=(120, 30), style=wx.CB_READONLY) else: self.textbox_client_sex = wx.TextCtrl(panel_client_intel, -1, pos=(190, 90), size=(100, 30)) self.textbox_client_birth = wx.TextCtrl(panel_client_intel, -1, pos=(340, 90), size=(120, 30)) self.textbox_client_cpf = wx.TextCtrl(panel_client_intel, -1, pos=(190, 150), size=(120, 30)) self.textbox_client_telephone = wx.TextCtrl(panel_client_intel, -1, pos=(340, 150), size=(120, 30)) self.textbox_client_email = wx.TextCtrl(panel_client_intel, -1, pos=(10, 210), size=(300, 30)) self.textbox_client_cep = wx.TextCtrl(panel_client_intel, -1, pos=(340, 210), size=(120, 30)) if self.editable: self.textbox_client_state = wx.ComboBox(panel_client_intel, -1, choices=core.brazil_states, pos=(10, 270), size=(60, 30), style=wx.CB_READONLY) else: self.textbox_client_state = wx.TextCtrl(panel_client_intel, -1, pos=(10, 270), size=(60, 30)) self.textbox_client_city = wx.TextCtrl(panel_client_intel, -1, pos=(100, 270), size=(150, 30)) self.textbox_client_district = wx.TextCtrl(panel_client_intel, -1, pos=(280, 270), size=(150, 30)) self.textbox_client_address = wx.TextCtrl(panel_client_intel, -1, pos=(10, 330), size=(300, 30)) self.textbox_client_observations = wx.TextCtrl(panel_client_intel, -1, pos=(10, 390), size=(480, 100), style=wx.TE_MULTILINE) self.textbox_client_cpf.Bind(wx.EVT_CHAR, core.check_cpf) self.textbox_client_birth.Bind(wx.EVT_CHAR, core.check_date) self.textbox_client_telephone.Bind(wx.EVT_CHAR, core.check_telephone) self.textbox_client_cep.Bind(wx.EVT_CHAR, core.check_cep) self.textbox_client_birth.SetValue(u'__/__/____') self.panel_client_image = wx.Panel(panel_client_intel, -1, size=(150, 150), pos=(10, 25), style=wx.SIMPLE_BORDER) self.panel_client_image.SetBackgroundColour('#ffffff') wx.EVT_PAINT(self.panel_client_image, self.OnPaint) panel_bottom = wx.Panel(self, -1, pos=(0, 500), size=(500, 50)) if self.editable: panel_bottom_buttons = wx.Panel(panel_bottom, pos=(90, 5), size=(320, 40), style=wx.SIMPLE_BORDER) finish = GenBitmapTextButton(panel_bottom_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Check.png', wx.BITMAP_TYPE_PNG), u"Salvar", pos=(0, 0), size=(100, 40)) finish.Bind(wx.EVT_BUTTON, self.ask_end) restart = GenBitmapTextButton(panel_bottom_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), u"Recomeçar", pos=(100, 0), size=(120, 40)) restart.Bind(wx.EVT_BUTTON, self.ask_clean) cancel = GenBitmapTextButton(panel_bottom_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png', wx.BITMAP_TYPE_PNG), u"Sair", pos=(220, 0), size=(100, 40)) cancel.Bind(wx.EVT_BUTTON, self.ask_exit) else: panel_bottom_buttons = wx.Panel(panel_bottom, pos=(150, 5), size=(200, 40), style=wx.SIMPLE_BORDER) edipo = GenBitmapTextButton(panel_bottom_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u"Editar", pos=(0, 0), size=(100, 40)) edipo.Bind(wx.EVT_BUTTON, self.set_editable) cancel = GenBitmapTextButton(panel_bottom_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png', wx.BITMAP_TYPE_PNG), u"Sair", pos=(100, 0), size=(100, 40)) cancel.Bind(wx.EVT_BUTTON, self.ask_exit) panel_side = wx.Panel(self, -1, pos=(500, 10), size=(340, 530), style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL) self.textbox_client_intel = wx.TextCtrl(panel_side, -1, pos=(10, 10), size=(320, 100), style=wx.TE_MULTILINE | wx.NO_BORDER) self.textbox_client_intel.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) if self.editable: bp1 = wx.Panel(panel_side, -1, pos=(20, 120), size=(300, 40), style=wx.SIMPLE_BORDER) sunbind = GenBitmapTextButton(bp1, -1, wx.Bitmap(core.directory_paths['icons'] + 'list-remove.png', wx.BITMAP_TYPE_PNG), u'Apagar Venda', pos=(120, 0), size=(180, 40)) sunbind.Bind(wx.EVT_BUTTON, self.ask_sale_delete) ssee = GenBitmapTextButton(bp1, -1, wx.Bitmap(core.directory_paths['icons'] + 'edit_find.png', wx.BITMAP_TYPE_PNG), u'Ver Mais', pos=(0, 0), size=(120, 40)) ssee.Bind(wx.EVT_BUTTON, self.sale_view) else: bp1 = wx.Panel(panel_side, -1, pos=(110, 120), size=(120, 40), style=wx.SIMPLE_BORDER) ssee = GenBitmapTextButton(bp1, -1, wx.Bitmap(core.directory_paths['icons'] + 'edit_find.png', wx.BITMAP_TYPE_PNG), u'Ver Mais', pos=(0, 0), size=(120, 40)) ssee.Bind(wx.EVT_BUTTON, self.sale_view) self.list_bought = wx.ListCtrl(panel_side, -1, pos=(10, 170), size=(320, 350), style=wx.LC_VRULES | wx.LC_HRULES | wx.LC_REPORT | wx.SIMPLE_BORDER) self.list_bought.InsertColumn(0, u'Data', width=90) self.list_bought.InsertColumn(1, u'Horário', width=90) self.list_bought.InsertColumn(2, u'Valor', width=100) self.list_bought.InsertColumn(3, u'Pago', width=40) self.list_bought.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.sale_view) self.clean() if not self.editable: self.textbox_client_name.Disable() self.textbox_client_sex.Disable() self.textbox_client_birth.Disable() self.textbox_client_telephone.Disable() self.textbox_client_cep.Disable() self.textbox_client_email.Disable() self.textbox_client_cpf.Disable() self.textbox_client_state.Disable() self.textbox_client_city.Disable() self.textbox_client_district.Disable() self.textbox_client_address.Disable() self.textbox_client_observations.Disable()
def setup_gui(self): self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.Centre() self.SetIcon(wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO)) part1 = wx.Panel(self, -1, pos=(10, 10), size=(1180, 290), style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL) self.text_profit = wx.TextCtrl(part1, -1, pos=(200, 50), size=(100, 30), style=wx.TE_READONLY) self.text_income = wx.TextCtrl(part1, -1, pos=(200, 90), size=(100, 30), style=wx.TE_READONLY) self.text_spent = wx.TextCtrl(part1, -1, pos=(200, 130), size=(100, 30), style=wx.TE_READONLY) self.text_wasted = wx.TextCtrl(part1, -1, pos=(200, 170), size=(100, 30), style=wx.TE_READONLY) self.text_income_pendant = wx.TextCtrl(part1, -1, pos=(200, 210), size=(100, 30), style=wx.TE_READONLY) self.text_expense_pendant = wx.TextCtrl(part1, -1, pos=(200, 250), size=(100, 30), style=wx.TE_READONLY) self.text_daily_income = wx.TextCtrl(part1, -1, pos=(500, 10), size=(100, 30), style=wx.TE_READONLY) self.text_credit_card_income = wx.TextCtrl(part1, -1, pos=(500, 50), size=(100, 30), style=wx.TE_READONLY) self.text_money_income = wx.TextCtrl(part1, -1, pos=(500, 90), size=(100, 30), style=wx.TE_READONLY) self.text_worst_week_day = wx.TextCtrl(part1, -1, pos=(500, 130), size=(100, 30), style=wx.TE_READONLY) self.text_better_week_day = wx.TextCtrl(part1, -1, pos=(500, 170), size=(100, 30), style=wx.TE_READONLY) self.text_income_pendant_amount = wx.TextCtrl(part1, -1, pos=(500, 210), size=(100, 30), style=wx.TE_READONLY) self.text_expense_pendant_amount = wx.TextCtrl(part1, -1, pos=(500, 250), size=(100, 30), style=wx.TE_READONLY) self.list_left = wx.ListCtrl(part1, -1, pos=(625, 30), size=(250, 240), style=wx.SIMPLE_BORDER | wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES) self.list_right = wx.ListCtrl(part1, -1, pos=(900, 30), size=(250, 240), style=wx.SIMPLE_BORDER | wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES) self.list_left.InsertColumn(0, u'Descrição') self.list_left.InsertColumn(1, u'Quantidade') self.list_left.InsertColumn(2, u'Valor') self.list_right.InsertColumn(3, u'Descrição') self.list_right.InsertColumn(4, u'Quantidade') self.list_right.InsertColumn(5, u'Valor') wx.StaticText(part1, -1, u'Mês/Ano', pos=(10, 17)) wx.StaticText(part1, -1, u'Lucro', pos=(10, 57)) wx.StaticText(part1, -1, u'Receita', pos=(10, 97)) wx.StaticText(part1, -1, u'Custos', pos=(10, 137)) wx.StaticText(part1, -1, u'Total Perdido', pos=(10, 177)) wx.StaticText(part1, -1, u'Entradas Pendentes de Pagamento', pos=(10, 217)) wx.StaticText(part1, -1, u'Gastos Pendentes de Pagamento', pos=(10, 257)) wx.StaticText(part1, -1, u'Rendimento Médio por dia', pos=(310, 17)) wx.StaticText(part1, -1, u'Total Vendido no Cartão', pos=(310, 57)) wx.StaticText(part1, -1, u'Total Vendido em Dinheiro', pos=(310, 97)) wx.StaticText(part1, -1, u'Dia da Semana menos Rentável', pos=(310, 137)) wx.StaticText(part1, -1, u'Dia da Semana mais Rentável', pos=(310, 177)) wx.StaticText(part1, -1, u'Quantidade de Entradas Pendentes', pos=(310, 217)) wx.StaticText(part1, -1, u'Quantidade de Gastos Pendentes', pos=(310, 257)) wx.StaticText(part1, -1, u'Produtos de Maior Redimento', pos=(625, 10)).SetFont( wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD)) wx.StaticText(part1, -1, u'Produtos Mais Vendidos', pos=(900, 10)).SetFont( wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD)) part2 = wx.Panel(self, -1, pos=(10, 305), size=(1180, 50), style=wx.TAB_TRAVERSAL) part21 = wx.Panel(part2, -1, pos=(10, 0), size=(620, 50), style=wx.SIMPLE_BORDER) part22 = wx.Panel(part2, -1, pos=(790, 0), size=(380, 50), style=wx.SIMPLE_BORDER) button1 = GenBitmapTextButton( part21, -1, wx.Bitmap(core.directory_paths['icons'] + 'Report.png', wx.BITMAP_TYPE_PNG), u'Tabela de Vendas', pos=(0, 0), size=(150, 50)) button2 = GenBitmapTextButton( part21, -1, wx.Bitmap(core.directory_paths['icons'] + 'Report.png', wx.BITMAP_TYPE_PNG), u'Tabela de Gastos', pos=(150, 0), size=(150, 50)) button3 = GenBitmapTextButton( part21, -1, wx.Bitmap(core.directory_paths['icons'] + 'Report.png', wx.BITMAP_TYPE_PNG), u'Tabela de Produtos', pos=(300, 0), size=(150, 50)) button7 = GenBitmapTextButton( part21, -1, wx.Bitmap(core.directory_paths['icons'] + 'Report.png', wx.BITMAP_TYPE_PNG), u'Tabela de Desperdícios', pos=(450, 0), size=(170, 50)) button8 = GenBitmapTextButton( part2, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), u'Recalcular', pos=(645, 0), size=(130, 50), style=wx.SIMPLE_BORDER) button4 = GenBitmapTextButton( part22, -1, wx.Bitmap(core.directory_paths['icons'] + 'system-users.png', wx.BITMAP_TYPE_PNG), u'Registar Gasto', pos=(0, 0), size=(130, 50)) button5 = GenBitmapTextButton( part22, -1, wx.Bitmap(core.directory_paths['icons'] + 'system-users.png', wx.BITMAP_TYPE_PNG), u'Registrar Ganho', pos=(130, 0), size=(130, 50)) button6 = GenBitmapTextButton( part22, -1, wx.Bitmap(core.directory_paths['icons'] + 'system-users.png', wx.BITMAP_TYPE_PNG), u'Observações', pos=(260, 0), size=(120, 50)) button1.Bind(wx.EVT_BUTTON, self.open_sheets_sales) button2.Bind(wx.EVT_BUTTON, self.open_sheets_expenses) button3.Bind(wx.EVT_BUTTON, self.open_sheets_products) button7.Bind(wx.EVT_BUTTON, self.open_sheets_wastes) button8.Bind(wx.EVT_BUTTON, self.setup) button4.Bind(wx.EVT_BUTTON, self.open_new_monthly_expense) button5.Bind(wx.EVT_BUTTON, self.open_new_monthly_income) button6.Bind(wx.EVT_BUTTON, self.open_text_box) button1.SetBackgroundColour(core.COLOR_LIGHT_YELLOW) button2.SetBackgroundColour(core.COLOR_LIGHT_YELLOW) button3.SetBackgroundColour(core.COLOR_LIGHT_YELLOW) button7.SetBackgroundColour(core.COLOR_LIGHT_YELLOW) button4.SetBackgroundColour(core.COLOR_LIGHT_BLUE) button5.SetBackgroundColour(core.COLOR_LIGHT_BLUE) button6.SetBackgroundColour(core.COLOR_LIGHT_BLUE) part3 = wx.Panel(self, pos=(10, 360), size=(1180, 280), style=wx.SIMPLE_BORDER) part31 = wx.Panel(part3, 56, pos=(10, 5), size=(575, 260), style=wx.SUNKEN_BORDER) part31.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.list_incomes = wx.gizmos.TreeListCtrl(part31, -1, pos=(10, 10), size=(400, 240), style=wx.SIMPLE_BORDER | wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT) self.list_incomes.AddColumn(u"Data", width=110) self.list_incomes.AddColumn(u"Descrição", width=180) self.list_incomes.AddColumn(u"Valor", width=100) self.list_incomes.SetMainColumn(0) dr = wx.StaticText(part31, -1, u'Ganhos\nMensais', pos=(420, 10)) dr.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD)) last_panel = wx.Panel(part31, pos=(420, 80), size=(145, 160), style=wx.SIMPLE_BORDER) button31 = GenBitmapTextButton( last_panel, -1, wx.Bitmap(core.directory_paths['icons'] + 'Add.png', wx.BITMAP_TYPE_PNG), u'Adicionar', pos=(0, 0), size=(145, 40)) button32 = GenBitmapTextButton( last_panel, -1, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u'Editar', pos=(0, 40), size=(145, 40)) button33 = GenBitmapTextButton( last_panel, -1, wx.Bitmap(core.directory_paths['icons'] + 'Trash.png', wx.BITMAP_TYPE_PNG), u'Apagar', pos=(0, 80), size=(145, 40)) button34 = GenBitmapTextButton( last_panel, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), u'Atualizar', pos=(0, 120), size=(145, 40)) button31.Bind(wx.EVT_BUTTON, self.open_new_monthly_income) button32.Bind(wx.EVT_BUTTON, self.open_edit_monthly_income) button33.Bind(wx.EVT_BUTTON, self.ask_delete_income) button34.Bind(wx.EVT_BUTTON, self.setup_monthly_incomes) part32 = wx.Panel(part3, 56, pos=(590, 5), size=(575, 260), style=wx.SUNKEN_BORDER) part32.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.list_expenses = wx.gizmos.TreeListCtrl(part32, -1, pos=(10, 10), size=(400, 240), style=wx.SIMPLE_BORDER | wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT) self.list_expenses.AddColumn(u"Data", width=110) self.list_expenses.AddColumn(u"Descrição", width=180) self.list_expenses.AddColumn(u"Valor", width=100) self.list_expenses.SetMainColumn(0) dr = wx.StaticText(part32, -1, u'Gastos\nMensais', pos=(420, 10)) dr.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD)) last_buttons = wx.Panel(part32, pos=(420, 80), size=(145, 160), style=wx.SIMPLE_BORDER) button41 = GenBitmapTextButton( last_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Add.png', wx.BITMAP_TYPE_PNG), u'Adicionar', pos=(0, 0), size=(145, 40)) button42 = GenBitmapTextButton( last_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u'Editar', pos=(0, 40), size=(145, 40)) button43 = GenBitmapTextButton( last_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Trash.png', wx.BITMAP_TYPE_PNG), u'Apagar', pos=(0, 80), size=(145, 40)) button44 = GenBitmapTextButton( last_buttons, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png', wx.BITMAP_TYPE_PNG), u'Atualizar', pos=(0, 120), size=(145, 40)) button41.Bind(wx.EVT_BUTTON, self.open_new_monthly_expense) button42.Bind(wx.EVT_BUTTON, self.open_edit_monthly_expense) button43.Bind(wx.EVT_BUTTON, self.ask_delete_expense) button44.Bind(wx.EVT_BUTTON, self.setup_monthly_expenses) db = database.TransactionsDB() dates = db.list_record_dates(transactions=True) db.close() month_options = list() for date in dates: date_ = core.format_date_user(date[:7]) if date_ not in month_options: month_options.append(date_) self.combobox_month_displayed = wx.ComboBox(part1, -1, choices=month_options, size=(100, 30), pos=(200, 15), style=wx.CB_READONLY) self.combobox_month_displayed.Bind(wx.EVT_COMBOBOX, self.setup) if len(month_options) != 0: self.combobox_month_displayed.SetValue(month_options[0])
def setup_gui(self): self.SetPosition(wx.Point(100, 100)) self.SetSize(wx.Size(1200, 550)) self.SetIcon(wx.Icon(core.ICON_MAIN, wx.BITMAP_TYPE_ICO)) self.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) panel_general = wx.Panel(self, pos=(10, 10), size=(1180, 100)) if self.client_selection_mode: sele = GenBitmapTextButton(panel_general, -1, wx.Bitmap(core.directory_paths['icons'] + 'Check.png', wx.BITMAP_TYPE_PNG), u'Selecionar', pos=(10, 40), size=(120, 40), style=wx.SIMPLE_BORDER) sele.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) sele.Bind(wx.EVT_BUTTON, self.data_select) panel_top = wx.Panel(panel_general, -1, size=(400, 40), pos=(200, 40), style=wx.SIMPLE_BORDER) see = GenBitmapTextButton(panel_top, -1, wx.Bitmap(core.directory_paths['icons'] + 'user-info.png', wx.BITMAP_TYPE_PNG), u'Ver Mais', pos=(0, 0), size=(100, 40)) see.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) see.Bind(wx.EVT_BUTTON, self.data_open) plus = GenBitmapTextButton(panel_top, -1, wx.Bitmap(core.directory_paths['icons'] + 'contact-new.png', wx.BITMAP_TYPE_PNG), u'Novo', pos=(100, 0), size=(100, 40)) plus.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) plus.Bind(wx.EVT_BUTTON, self.open_client_registry) edi = GenBitmapTextButton(panel_top, -1, wx.Bitmap(core.directory_paths['icons'] + 'Edit.png', wx.BITMAP_TYPE_PNG), u'Editar', pos=(200, 0), size=(100, 40)) edi.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) edi.Bind(wx.EVT_BUTTON, self.data_edit) era = GenBitmapTextButton(panel_top, -1, wx.Bitmap(core.directory_paths['icons'] + 'Trash.png', wx.BITMAP_TYPE_PNG), u'Apagar', pos=(300, 0), size=(100, 40)) era.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) era.Bind(wx.EVT_BUTTON, self.ask_delete) self.textbox_filter = wx.SearchCtrl(panel_general, -1, pos=(650, 45), size=(200, 30), style=wx.TE_PROCESS_ENTER) self.textbox_filter.SetDescriptiveText(u'Busca por nome') self.textbox_filter.ShowCancelButton(True) fin = wx.BitmapButton(panel_general, -1, wx.Bitmap(core.directory_paths['icons'] + 'edit_find.png'), pos=(855, 42), size=(35, 35), style=wx.NO_BORDER) fin.Bind(wx.EVT_BUTTON, self.database_search) fin.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) self.textbox_filter.Bind(wx.EVT_TEXT_ENTER, self.database_search) self.textbox_filter.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.database_search) panel_bottom = wx.Panel(panel_general, size=(240, 40), pos=(930, 40), style=wx.SIMPLE_BORDER) button_exit = GenBitmapTextButton(panel_bottom, -1, wx.Bitmap(core.directory_paths['icons'] + 'Exit.png'), u'Sair', pos=(120, 0), size=(120, 40)) button_exit.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) button_exit.Bind(wx.EVT_BUTTON, self.exit) rep = GenBitmapTextButton(panel_bottom, -1, wx.Bitmap(core.directory_paths['icons'] + 'Reset.png'), u'Atualizar', pos=(0, 0), size=(120, 40)) rep.SetBackgroundColour(core.COLOR_DEFAULT_BACKGROUND) rep.Bind(wx.EVT_BUTTON, self.setup) panel_middle = wx.Panel(self, -1, pos=(10, 110), size=(1180, 410)) self.list_clients = wx.ListCtrl(panel_middle, -1, pos=(5, 5), size=(1170, 390), style=wx.LC_VRULES | wx.LC_HRULES | wx.SIMPLE_BORDER | wx.LC_REPORT) self.list_clients.InsertColumn(0, u'Nome do cliente', width=300) self.list_clients.InsertColumn(1, u'ID', width=50) self.list_clients.InsertColumn(2, u'CPF', width=100) self.list_clients.InsertColumn(3, u'Telefone', width=200) self.list_clients.InsertColumn(4, u'e-mail', width=200) self.list_clients.InsertColumn(5, u'Endereço', width=315) if self.client_selection_mode: self.list_clients.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.data_select) else: self.list_clients.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.data_open)