def setState(self, widget, state='disabled'): World().LOG().info("setState called: " + state) if widget.winfo_class() == 'TLabel': return try: widget.configure(state=state) except TclError: pass for child in widget.winfo_children(): if child.winfo_class() in ('TEntry', 'Text', 'TFrame', 'Button'): if child.winfo_class() != 'TFrame': child.configure(state=state) if child.winfo_class() == 'Text': if state == 'disabled': child.configure( background=World.getDisabledBackgroundColor()) child.configure( foreground=World.getDisabledForegroundColor()) else: child.configure( background=World.getNormalBackgroundColor()) child.configure( foreground=World.getNormalForegroundColor()) self._myState = state
def _initStyles(self): Style().map("TEntry", foreground=[('disabled', World.getDisabledForegroundColor()), ('active', World.getNormalForegroundColor())], fieldbackground=[('disabled', World.getDisabledBackgroundColor())])
def appendRow(self, data): r = len(self.__widgets)+1 c = 0 dataIdx = 0 actualRow = [] for columnData in data: widget = None if r > 1 and c == 0: widget = Button(self.__widgetFrame, text=columnData, width=World.smallButtonWidth(), command= lambda: self.__editRow(data)) else: if dataIdx not in self.__invisibleColumns: widget = Label(self.__widgetFrame, text=columnData) if widget != None: widget.grid(row=r, column=c, sticky="ns", padx=World.smallPadSize(), pady=World.smallPadSize()) actualRow.append(widget) c += 1 dataIdx += 1 self.__widgets.append(actualRow) self.__data.append(data)
def setState(self, widget, state='disabled'): World().LOG().info("setState called: " + state) if widget.winfo_class() == 'TLabel': return try: widget.configure(state=state) except TclError: pass for child in widget.winfo_children(): if child.winfo_class() in ('TEntry', 'Text', 'TFrame', 'Button'): if child.winfo_class() != 'TFrame': child.configure(state=state) if child.winfo_class() == 'Text': if state == 'disabled': child.configure(background=World.getDisabledBackgroundColor()) child.configure(foreground=World.getDisabledForegroundColor()) else: child.configure(background=World.getNormalBackgroundColor()) child.configure(foreground=World.getNormalForegroundColor()) self._myState = state
def __init__(self, master=None): World.init() Frame.__init__(self, master) Tk.report_callback_exception = self._show_error self.master.protocol("WM_DELETE_WINDOW", self._onExit) self._initStyles() self._login()
def appendRow(self, data): r = len(self.__widgets) + 1 c = 0 dataIdx = 0 actualRow = [] for columnData in data: widget = None if r > 1 and c == 0: widget = Button(self.__widgetFrame, text=columnData, width=World.smallButtonWidth(), command=lambda: self.__editRow(data)) else: if dataIdx not in self.__invisibleColumns: widget = Label(self.__widgetFrame, text=columnData) if widget != None: widget.grid(row=r, column=c, sticky="ns", padx=World.smallPadSize(), pady=World.smallPadSize()) actualRow.append(widget) c += 1 dataIdx += 1 self.__widgets.append(actualRow) self.__data.append(data)
def _createControls(self): self.__plusButton = Button(self, text='+', width=World.smallButtonWidth(), command=self.__appendRow) self.__plusButton.grid(row=1, column=0, padx=World.smallPadSize(), pady=World.smallPadSize(), sticky="SW")
def _show_error(self, *args): err = World().L("Exception.GENERAL") for elem in traceback.format_exception(*args): err += elem World().LOG().error(err) mbox.showerror(World().L('Exception.TITLE'), err) self._onExit()
def _handleChangeWhileInEditMode(self): World().LOG().info("_handleChangeWhileInEditMode called: " + str(self._entity.id) + "|" + self._entity.name) QuestionDialog(self, title=World.L('QUESTION'), message=World.L('AbstractFrame.ARC'), cancelLabel=World.L('PROCEED_NO_SAVE')) if self.answer == 'SAVE': self._save()
def _createWidgets(self): r = 0 c = 0 self._nameLabel = Label(self, text=World.L("NAME")); self._nameLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._nameEntry = Entry(self, width=World.defaultEntryWidth()) self._nameEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._groupNrLabel = Label(self, text=World.L("ADDRESS")) self._groupNrLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._groupNrEntry = Entry(self, width=World.defaultEntryWidth()) self._groupNrEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._remarkLabel = Label(self, text=World.L("REMARK")) self._remarkLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._remarkEntry = Text(self, width=World.textEntryWidth(), height=10) self._remarkEntry.grid(row=r, column=c, sticky="WE", padx=World.smallPadSize(), pady=World.smallPadSize()) # Append operation buttons c = 0 r += 1 AbstractFrame._createWidgets(self, r , c, 2)
def __init__(self, master, person): Toplevel.__init__(self, master) World.LOG().info("PersonDialog opening.") self.title(World.L("PersonDialog.TITLE")) self['bd'] = World.padSize() self.__person = person self.__createWidgets() self.__showItem() self.setModal()
def __init__(self, master, appEntity, entity): Toplevel.__init__(self, master) World.LOG().info("ChooserDialog opening.") self.title(World.L("ChooserDialog.TITLE")) self['bd'] = World.padSize() self.__appEntity = appEntity self.__entity = entity self.__createWidgets() self.__fillListWithElements() self.__showItem() self.setModal()
def _save(self, is_new_entity=False): World().LOG().info("_save called: " + str(self._entity.id) + "|" + self._entity.name) if self._validate() != None: return False self.createButtonEnabled(True) self.editButtonEnabled(True) self.saveButtonEnabled(False) self.cancelButtonEnabled(False) self.deleteButtonEnabled(True) self.closeButtonEnabled(True) self.setState(self, 'disabled') if self._entity.id == 0 or is_new_entity: self._myEntityType.create(self._entity) else: self._myEntityType.update(self._entity) #refresh the listbox idx = 0 self._myStoredListItems = self._myEntityType.getListItems() for item in self._myStoredListItems: if item.id == self._entity.id: if len(self._myListBox.curselection()) > 0: self._myListBox.delete(self._myListBox.curselection()[0]) self._myListBox.insert(idx, self._myStoredListItems[idx].name) break idx += 1 self._myListBox.selection_set(idx) self._is_new_entity = False
def showDialog(self, tabTitle): World().LOG().info("showDialog called: " + tabTitle) found = False oneTab = '' for oneTab in self._myApplication.noteBookPanel.tabs(): if oneTab == self._windowName: found = True break if found: self._myApplication.noteBookPanel.select(oneTab) else: self._myApplication.noteBookPanel.add(self, text=tabTitle) self._windowName = self._myApplication.noteBookPanel.select() self._myListBox = self._myApplication.getListBox() self._myListBox.bind('<<ListboxSelect>>', self.refreshDetails) self._createWidgets() self._fillListWithElements() elementId = 0 if self._entity != None: elementId = self._entity.id self._displayElement(elementId) # show or refresh data from DB self._setControls()
def refreshDetails(self, params): selectedIdx = int(self._myListBox.curselection()[0]) id = self._myStoredListItems[selectedIdx].id name = self._myStoredListItems[selectedIdx].name World().LOG().info("_refreshDetails called: idx=" + str(selectedIdx) + " id=" + str(id) + " name=" + name) self._displayElement(id)
def _displayElement(self, elementId): World().LOG().info("_displayElement called: " + str(elementId)) if len(self._myStoredListItems) < 1: '''handle the empty datatable case''' self._create() return self.answer = '' if self._getState() == 'normal' and elementId != self._myElementId: self._handleChangeWhileInEditMode() if self.answer != 'ABORT': self._myElementId = elementId idx = 0 if self._myElementId == 0: idx = 0 else: for item in self._myStoredListItems: if item.id == self._myElementId: break idx += 1 if self.answer != 'ABORT': self.setState(self, 'normal') self.showItem(self._myStoredListItems[idx].id) self.setState(self, 'disabled') self._myListBox.selection_clear(0, END) self._myListBox.selection_set(idx)
def setState(self, state='disabled'): World.LOG().info("MinuxTable.setState called ") if self.__plusButton != None: self.__plusButton.configure(state=state) for row in self.__widgets: for widget in row: if widget != None and widget.winfo_class() == 'TButton': widget.configure(state=state)
def clear(self): return World.LOG().info("MinuxTable.clear() called") for widget in self.__widgetFrame.grid_slaves(): widget.grid_forget() widget.destroy() del self.__widgets[1:] del self.__data[:]
def _edit(self): self._is_new_entity = False World().LOG().info("_edit called: " + str(self._entity.id) + "|" + self._entity.name) self.setState(self, 'normal') self.createButtonEnabled(False) self.saveButtonEnabled(True) self.cancelButtonEnabled(True) self.deleteButtonEnabled(False)
def _createMenu(self): menubar = Menu(self.master, tearoff=0) menuItems = Main.getMainMenuItems() for element in menuItems: World().LOG().debug("Menu item: " + element.name) if (element.is_root == True): newMenu = Menu(menubar, tearoff=0) menubar.add_cascade(label=World.L("MainWindow." + element.name), menu=newMenu) for item in menuItems: if (item.is_root == False and item.parent == element.name): com = "_on" + item.name.capitalize() function = getattr(self, com) newMenu.add_command(label=World.L("MainWindow." + item.name), command=function) self.master.config(menu=menubar)
def _fillListWithElements(self): World().LOG().info("_fillListWithElement called.") self._myStoredListItems = self._myEntityType.getListItems() for e in self._myStoredListItems: self._myListBox.insert(END, e.name) self.createButtonEnabled(True) self.editButtonEnabled(True) self.closeButtonEnabled(True) self.deleteButtonEnabled(True)
def __init__(self, master, columns=2, rows=1, header=('First header', 'Second header'), type=None): Frame.__init__(self, master, padding=World.padSize()) self.__type = type self.__columnCount = columns self.__data = [] self.__createGrid() self.setHeader(header) self._createControls()
def _createLayout(self): self._mainPanedWindow = PanedWindow(orient=HORIZONTAL) self._mainPanedWindow.pack(fill=BOTH, expand=1) self._leftPanel = Canvas(self._mainPanedWindow, background="pink") self._mainPanedWindow.add(self._leftPanel) self.noteBookPanel = Notebook(self._mainPanedWindow) self._mainPanedWindow.add(self.noteBookPanel) buttonFrame = Frame() buttonFrame.pack(side=RIGHT, padx=World.smallPadSize(), pady=World.padSize()) self.exitButton = Button(buttonFrame, text=World.L("MainWindow.EXIT"), command=self._onExit) self.exitButton.pack(fill=BOTH, expand=1, side=LEFT, padx=World.smallPadSize())
def editChild(self, childType, data): World.LOG().info("editChild called: " + childType + " " + str(data)) if childType == self._personType: if len(data) == 0: data = [0, 0, '', self._entity.id, '', '', '', ''] person = Person.unserialize(data) person = self._editPerson(person) if person.name != '': data = Person.serialize(person) else: data = [] if person.markedForDeletion: data[1] = MinuxTable.ENTITY_IS_MARKED_FOR_DELETION return data
def editChild(self, childType, data): World.LOG().info("editChild called: " + childType + " " + str(data)) if childType == self._additiveGroupType: if len(data) == 0: data = [0, 0, '', 0, ''] ag = AdditiveGroup.unserialize(data) ag = self._editAdditiveGroup(ag) if ag.name != '': data = AdditiveGroup.serialize(ag) else: data = [] if ag.markedForDeletion: data[1] = ChooserTable.ENTITY_IS_MARKED_FOR_DELETION return data
def editChild(self, childType, data): World.LOG().info("editChild called: " + childType + " " + str(data)) if childType == self._rawMaterialContentType: if len(data) == 0: data = [0, 0, '', self._entity.id, '', '', '', ''] content = RawMaterialContent.unserialize(data) content = self._editRawMaterialContent(content) if content.name != '': data = RawMaterialContent.serialize(content) else: data = [] if content.markedForDeletion: data[1] = MinuxTable.ENTITY_IS_MARKED_FOR_DELETION return data
def __init__(self, master, title='', message='', abortLabel=World.L("ABORT"), saveLabel=World.L("SAVE"), cancelLabel=World.L("CANCEL")): tkinter.Toplevel.__init__(self, master) self._master = master self['bd'] = World.padSize() c = 0 r = 0 messageLabel = Label(self, text=message) messageLabel.grid(row=r, column=c, columnspan=3, padx=World.padSize(), pady=World.padSize()) r += 1 abortButton = Button(self, text=abortLabel, command= lambda:self._answer('ABORT')) abortButton.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 saveButton = Button(self, text=saveLabel, command= lambda:self._answer('SAVE')) saveButton.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 cancelButton = Button(self, text=cancelLabel, command= lambda:self._answer('CANCEL')) cancelButton.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) self.center() self.resizable(False, False) self.setModal()
def _createWidgets(self, r, c, cspan=0): buttonFrame = Frame(self) buttonFrame.grid(row=r, column=c, columnspan=cspan, sticky=E, padx=World.smallPadSize(), pady=World.smallPadSize()) self.createButton = Button(buttonFrame, text=World.L("CREATE"), state=DISABLED) self.createButton.pack(fill=BOTH, expand=1, side=LEFT, padx=World.smallPadSize()) self.editButton = Button(buttonFrame, text=World.L("MainWindow.EDIT"), state=DISABLED) self.editButton.pack(fill=BOTH, expand=1, side=LEFT, padx=World.smallPadSize()) self.saveButton = Button(buttonFrame, text=World.L("SAVE"), state=DISABLED) self.saveButton.pack(fill=BOTH, expand=1, side=LEFT, padx=World.smallPadSize()) self.cancelButton = Button(buttonFrame, text=World.L("CANCEL"), state=DISABLED) self.cancelButton.pack(fill=BOTH, expand=1, side=LEFT, padx=World.smallPadSize()) self.deleteButton = Button(buttonFrame, text=World.L("DELETE"), state=DISABLED) self.deleteButton.pack(fill=BOTH, expand=1, side=LEFT, padx=World.smallPadSize()) self.closeButton = Button(buttonFrame, text=World.L("CLOSE"), state=DISABLED) self.closeButton.pack(fill=BOTH, expand=1, side=LEFT, padx=World.smallPadSize())
def _delete(self): World().LOG().info("_delete called: " + str(self._entity.id) + "|" + self._entity.name) idx = int(self._myListBox.curselection()[0]) new_idx = 0 old_entity = deepcopy(self._entity) if idx > 0: new_idx = idx - 1 else: new_idx = idx self._myListBox.delete(idx) for item in self._myStoredListItems: if item.id == old_entity.id: self._myStoredListItems.remove(item) break self._myEntityType.delete(old_entity) self._displayElement(self._myStoredListItems[new_idx].id)
def _createWidgets(self): r = 0 c = 0 self._nameLabel = Label(self, text=World.L("NAME")); self._nameLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._nameEntry = Entry(self, width=World.defaultEntryWidth()) self._nameEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._remarkLabel = Label(self, text=World.L("REMARK")) self._remarkLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._remarkEntry = Text(self, width=World.textEntryWidth(), height=10) self._remarkEntry.grid(row=r, column=c, sticky="WE", padx=World.smallPadSize(), pady=World.smallPadSize()) # Append operation buttons c = 0 r += 1 AbstractFrame._createWidgets(self, r , c, 2)
def _close(self): World().LOG().info("_close called: " + str(self._entity.id) + "|" + self._entity.name) if self._getState() == 'normal': self._handleChangeWhileInEditMode() if self.answer != 'ABORT': self._myListBox.delete(0, END) self.master.forget('current') if self.master.index('end') > 0: self.master.select('end') else: self.createButtonEnabled(False) self.closeButtonEnabled(False) self.saveButtonEnabled(False) self.cancelButtonEnabled(False) self.editButtonEnabled(False) self.deleteButtonEnabled(False) self._myApplication.exitButton.config( command=self._myApplication._onExit) self._myApplication.destroy()
def __init__(self, master, appFrame, elementId=0): World().LOG().info("Frame called: " + self._type) Frame.__init__(self, master, padding= World.padSize()) self._myApplication = appFrame self._myElementId = elementId
def _createWidgets(self): r = 0 c = 0 self._nameLabel = Label(self, text=World.L("NAME")) self._nameLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._nameEntry = Entry(self, width=World.defaultEntryWidth()) self._nameEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._isCompositeLabel = Label(self, text=World.L("IS_COMPOSITE")) self._isCompositeLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._isCompositeEntry = Entry(self, width=World.defaultEntryWidth()) self._isCompositeEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._contentLabel = Label(self, text=World.L("CONTENTS")) self._contentLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 hd = (World.L('ID'), World.L('NAME'), World.L('%'), World.L('REMARK')) self._contentTable = MinuxTable(self, columns=4, header=hd, type=self._rawMaterialContentType) # self._contentTable.setInvisibleColumns((1,3, 7)) self._contentTable.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._remarkLabel = Label(self, text=World.L("REMARK")) self._remarkLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._remarkEntry = Text(self, width=World.textEntryWidth(), height=10) self._remarkEntry.grid(row=r, column=c, sticky="WE", padx=World.smallPadSize(), pady=World.smallPadSize()) # Append operation buttons c = 0 r += 1 AbstractFrame._createWidgets(self, r, c, 2)
def _createWidgets(self): r = 0 c = 0 self._nameLabel = Label(self, text=World.L("NAME")); self._nameLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._nameEntry = Entry(self, width=World.defaultEntryWidth()) self._nameEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._regNumberLabel = Label(self, text=World.L("REG_NUMBER")) self._regNumberLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._regNumberEntry = Entry(self, width=World.defaultEntryWidth()) self._regNumberEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._bankAccountLabel = Label(self, text=World.L("BANK_ACCOUNT_NUMBER")) self._bankAccountLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._bankAccountEntry = Entry(self, width=World.defaultEntryWidth()) self._bankAccountEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._headCityLabel = Label(self, text=World.L("LOCATION")) self._headCityLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._headCityEntry = Entry(self, width=World.defaultEntryWidth()) self._headCityEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._headZipLabel = Label(self, text=World.L("ZIP")) self._headZipLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._headZipEntry = Entry(self, width=8) self._headZipEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._headAddressLabel = Label(self, text=World.L("ADDRESS")) self._headAddressLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._headAddressEntry = Entry(self, width=World.defaultEntryWidth()) self._headAddressEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._contactLabel = Label(self, text=World.L("CONTACTS")) self._contactLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 hd = (World.L('ID'), World.L('NAME'), World.L('ADDRESS'), World.L('PHONE'), World.L('EMAIL')) self._contactTable = MinuxTable(self, columns=6, header=hd, type=self._personType) self._contactTable.setInvisibleColumns((1,3, 7)) self._contactTable.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._remarkLabel = Label(self, text=World.L("REMARK")) self._remarkLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._remarkEntry = Text(self, width=World.textEntryWidth(), height=10) self._remarkEntry.grid(row=r, column=c, sticky="WE", padx=World.smallPadSize(), pady=World.smallPadSize()) # Append operation buttons c = 0 r += 1 AbstractFrame._createWidgets(self, r , c, 2)
def __init__(self, master, title='', message='', abortLabel=World.L("ABORT"), saveLabel=World.L("SAVE"), cancelLabel=World.L("CANCEL")): tkinter.Toplevel.__init__(self, master) self._master = master self['bd'] = World.padSize() c = 0 r = 0 messageLabel = Label(self, text=message) messageLabel.grid(row=r, column=c, columnspan=3, padx=World.padSize(), pady=World.padSize()) r += 1 abortButton = Button(self, text=abortLabel, command=lambda: self._answer('ABORT')) abortButton.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 saveButton = Button(self, text=saveLabel, command=lambda: self._answer('SAVE')) saveButton.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 cancelButton = Button(self, text=cancelLabel, command=lambda: self._answer('CANCEL')) cancelButton.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) self.center() self.resizable(False, False) self.setModal()
def _createWidgets(self): r = 0 c = 0 self._nameLabel = Label(self, text=World.L("NAME")); self._nameLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._nameEntry = Entry(self, width=World.defaultEntryWidth()) self._nameEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) r += 1 c = 0 self._barcodeLabel = Label(self, text=World.L("BARCODE")); self._barcodeLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._barcodeEntry = Entry(self, width=World.defaultEntryWidth()) self._barcodeEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._isEndProductLabel = Label(self, text=World.L("IS_END/IS_SEMI")) self._isEndProductLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._isEndProductEntry = Entry(self, width=World.defaultEntryWidth()) self._isEndProductEntry.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._contentLabel = Label(self, text=World.L("CONTENTS")) self._contentLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 hd = (World.L('ID'), World.L('NAME'), World.L('%'), World.L('REMARK')) self._contentTable = MinuxTable(self, columns=4, header=hd, type=self._rawMaterialContentType) # self._contentTable.setInvisibleColumns((1,3, 7)) self._contentTable.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._remarkLabel = Label(self, text=World.L("REMARK")) self._remarkLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._remarkEntry = Text(self, width=World.textEntryWidth(), height=10) self._remarkEntry.grid(row=r, column=c, sticky="WE", padx=World.smallPadSize(), pady=World.smallPadSize()) # Append operation buttons c = 0 r += 1 AbstractFrame._createWidgets(self, r , c, 2)
def __init__(self): World.LOG().info("AbstractEntityManager constructor called") self._db = World.DBA() self._cursor = self._db.cursor
def __createWidgets(self): c = 0 r = 0 idLabel = Label(self, text=World.L("ID")) idLabel.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self.__idEntry = Label(self) self.__idEntry.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) r += 1 c = 0 nameLabel = Label(self, text=World.L("NAME")) nameLabel.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self.__nameEntry = Entry(self, width=World.defaultEntryWidth()) self.__nameEntry.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) r += 1 c = 0 addressLabel = Label(self, text=World.L("ADDRESS")) addressLabel.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self.__addressEntry = Text(self, width=World.textEntryWidth(), height=4) self.__addressEntry.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) r += 1 c = 0 phoneLabel = Label(self, text=World.L("PHONE")) phoneLabel.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self.__phoneEntry = Text(self, width=World.textEntryWidth(), height=4) self.__phoneEntry.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) r += 1 c = 0 emailLabel = Label(self, text=World.L("EMAIL")) emailLabel.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self.__emailEntry = Text(self, width=World.textEntryWidth(), height=4) self.__emailEntry.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) r += 1 c = 0 remarkLabel = Label(self, text=World.L("REMARK")) remarkLabel.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self.__remarkEntry = Text(self, width=World.textEntryWidth(), height=10) self.__remarkEntry.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) ### BUTTONS ### r += 1 c = 0 f = Frame(self) readyButton = Button(f, text=World.L('READY'), command=self.__sendDataToMaster) readyButton.pack(side=LEFT, padx=World.smallPadSize(), pady=World.smallPadSize()) cancelButton = Button(f, text=World.L('CANCEL'), command=self.destroy) cancelButton.pack(side=LEFT, padx=World.smallPadSize(), pady=World.smallPadSize()) deleteButton = Button(f, text=World.L('DELETE'), command=self.__markForDeletion) deleteButton.pack(side=LEFT, padx=World.smallPadSize(), pady=World.smallPadSize()) f.grid(row=r, column=c, columnspan=2, sticky=E, padx=World.smallPadSize(), pady=World.smallPadSize()) self.center() self.resizable(False, False)