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 _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 __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 __init__(self, master): tkinter.Toplevel.__init__(self, master) World.LOG().info("Login process started.") self.protocol("WM_DELETE_WINDOW", master._onExit) self['bd'] = World.padSize() c = 0 r = 0 titleLabel = Label(self, text=World.L("LoginDialog.TITLE")) titleLabel.grid(row=r, column=c, columnspan=2, padx=World.padSize(), pady=World.padSize()) r += 1 nameLabel = Label(self, text=World.L("USERNAME")) nameLabel.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._nameEntry = Entry(self) self._nameEntry.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) r += 1 c = 0 passwordLabel = Label(self, text=World.L("PASSWORD")) passwordLabel.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._passwordEntry = Entry(self) self._passwordEntry.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) r += 1 c = 0 loginButton = Button(self, text=World.L('LOGIN'), command=lambda: master._onSuccessfulLogin(self)) loginButton.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 exitButton = Button(self, text=World.L('EXIT'), command=master._onExit) exitButton.grid(row=r, column=c, padx=World.smallPadSize(), pady=World.smallPadSize()) self.center() self.resizable(False, False) self.setModal()
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 __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 _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 _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._additiveGroupLabel = Label(self, text=World.L("ADDITIVE_GROUP")) self._additiveGroupLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 hd = (World.L('ID'), World.L('NAME')) self._additiveGroupTable = ChooserTable(self, columns=3, header=hd, type=self._additiveGroupType) self._additiveGroupTable.setInvisibleColumns((1,3,4)) self._additiveGroupTable.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c = 0 r += 1 self._eNumberLabel = Label(self, text=World.L("E_NUMBER")) self._eNumberLabel.grid(row=r, column=c, sticky=W, padx=World.smallPadSize(), pady=World.smallPadSize()) c += 1 self._eNumberEntry = Entry(self, width=World.defaultEntryWidth()) self._eNumberEntry.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 _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 _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 _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 exitButtonEnabled(self, isEnabled): if isEnabled: self.exitButton['state'] = NORMAL else: self.exitButton['state'] = DISABLED def getListBox(self): return self._listBox def getWorkPane(self): return self.noteBookPanel root = Tk() root.title(World.L("Application.TITLE")) w, h = root.winfo_screenwidth(), root.winfo_screenheight() #root.geometry("%dx%d+0+0" % (w, h-60)) root.geometry("1024x768") root.minsize(800, 600) mainApp = MainWindow(master=root) root.mainloop()
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 f = Frame(self) scrollBar = Scrollbar(f) scrollBar.pack(side=RIGHT, fill=Y) self._nameListBox = Listbox(f, yscrollcommand=scrollBar.set, selectmode=SINGLE) self._nameListBox.pack(fill=BOTH, side=LEFT, expand=1) scrollBar.config(command=self._nameListBox.yview) f.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()) f.grid(row=r, column=c, columnspan=2, sticky=E, padx=World.smallPadSize(), pady=World.smallPadSize()) self.center() self.resizable(False, False)
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 __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)