def afterInit(self): con = self.Form.Connection gs = self.Sizer = dGridSizer(MaxCols=7) self.bizStatic = biz.BizStatic(con) self.bizDaily = biz.BizDaily(con) header = calendar.weekheader(3).split() for x in header: gs.append(dLabel(self, Caption=x), alignment="center") for y in range(self._week_range): for x in range(7): gs.append(PnlDay(self, Pos=(x,y)), "expand") gs.setColExpand(True, x) gs.setRowExpand(True, y+1) self.setFocusToToday()
def afterInit(self): con = self.Form.Connection gs = self.Sizer = dGridSizer(MaxCols=7) self.bizStatic = biz.BizStatic(con) self.bizDaily = biz.BizDaily(con) header = calendar.weekheader(3).split() for x in header: gs.append(dLabel(self, Caption=x), alignment="center") for y in range(self._week_range): for x in range(7): gs.append(PnlDay(self, Pos=(x, y)), "expand") gs.setColExpand(True, x) gs.setRowExpand(True, y + 1) self.setFocusToToday()
def createControls(self): self.Caption = _("Connection Editor") self.bg = dui.dPanel(self, BackColor="LightSteelBlue") gbsz = dui.dGridSizer(VGap=12, HGap=5, MaxCols=2) # Add the fields # Connection Dropdown cap = dui.dLabel(self.bg, Caption=_("Connection")) ctl = dui.dDropdownList(self.bg, Choices=list(self.connDict.keys()), RegID="connectionSelector", OnHit=self.onConnectionChange) btn = dui.dButton(self.bg, Caption=_("Edit Name"), RegID="cxnEdit", OnHit=self.onCxnEdit) hsz = dui.dSizer("h") hsz.append(ctl) hsz.appendSpacer(10) hsz.append(btn) btn = dui.dButton(self.bg, Caption=_("Delete This Connection"), RegID="cxnDelete", DynamicEnabled=self.hasMultipleConnections, OnHit=self.onCxnDelete) hsz.appendSpacer(10) hsz.append(btn) gbsz.append(cap, halign="right", valign="middle") gbsz.append(hsz, valign="middle") # Backend Type cap = dui.dLabel(self.bg, Caption=_("Database Type")) ctl = dui.dDropdownList(self.bg, RegID="DbType", Choices=["MySQL", "Firebird", "PostgreSQL", "MsSQL", "SQLite"], DataSource="form", DataField="dbtype", OnHit=self.onDbTypeChanged) gbsz.append(cap, halign="right") gbsz.append(ctl) self.dbTypeSelector = ctl # Host cap = dui.dLabel(self.bg, Caption=_("Host")) ctl = dui.dTextBox(self.bg, DataSource="form", DataField="host") gbsz.append(cap, halign="right") gbsz.append(ctl, "expand") self.hostText = ctl # Port cap = dui.dLabel(self.bg, Caption=_("Port")) ctl = dui.dTextBox(self.bg, DataSource="form", DataField="port") gbsz.append(cap, halign="right") gbsz.append(ctl, "expand") self.portText = ctl # Database cap = dui.dLabel(self.bg, Caption=_("Database")) ctl = dui.dTextBox(self.bg, DataSource="form", DataField="database") hsz = dui.dSizer("h") self.btnDbSelect = dui.dButton(self.bg, Caption=" ... ", RegID="btnDbSelect", Visible=False, OnHit=self.onDbSelect) hsz.append1x(ctl) hsz.appendSpacer(2) hsz.append(self.btnDbSelect, 0, "x") gbsz.append(cap, halign="right") gbsz.append(hsz, "expand") self.dbText = ctl # Username cap = dui.dLabel(self.bg, Caption=_("User Name")) ctl = dui.dTextBox(self.bg, DataSource="form", DataField="user") gbsz.append(cap, halign="right") gbsz.append(ctl, "expand") self.userText = ctl # Password cap = dui.dLabel(self.bg, Caption=_("Password")) ctl = dui.dTextBox(self.bg, PasswordEntry=True, DataSource="form", DataField="password") gbsz.append(cap, halign="right") gbsz.append(ctl, "expand") self.pwText = ctl # Open Button btnSizer1 = dui.dSizer("h") btnSizer2 = dui.dSizer("h") btnTest = dui.dButton(self.bg, RegID="btnTest", Caption=_("Test..."), OnHit=self.onTest) btnSave = dui.dButton(self.bg, RegID="btnSave", Caption=_("Save"), OnHit=self.onSave) btnNewConn = dui.dButton(self.bg, RegID="btnNewConn", Caption=_("New Connection"), OnHit=self.onNewConn) btnNewFile = dui.dButton(self.bg, RegID="btnNewFile", Caption=_("New File"), OnHit=self.onNewFile) btnOpen = dui.dButton(self.bg, RegID="btnOpen", Caption=_("Open File..."), OnHit=self.onOpen) btnSizer1.append(btnTest, 0, border=3) btnSizer1.append(btnSave, 0, border=3) btnSizer2.append(btnNewConn, 0, border=3) btnSizer2.append(btnNewFile, 0, border=3) btnSizer2.append(btnOpen, 0, border=3) gbsz.setColExpand(True, 1) self.gridSizer = gbsz sz = self.bg.Sizer = dui.dSizer("v") sz.append(gbsz, 0, "expand", halign="center", border=20) sz.append(btnSizer1, 0, halign="center") sz.append(btnSizer2, 0, halign="center") # Only create the 'Set Crypto Key' button if PyCrypto is installed try: from Crypto.Cipher import DES3 as _TEST_DES3 self._showKeyButton = True del _TEST_DES3 except ImportError: self._showKeyButton = False if self._showKeyButton: self.cryptoKeyButton = dui.dButton(self.bg, Caption=_("Set Crypto Key"), OnHit=self.onSetCrypto) btnSizer1.append(self.cryptoKeyButton, 0, halign="center", border=3) self.Sizer = dui.dSizer("h") self.Sizer.append(self.bg, 1, "expand", halign="center") self.Layout()
def createControls(self): self.Caption = _("Connection Editor") self.bg = dui.dPanel(self, BackColor="LightSteelBlue") gbsz = dui.dGridSizer(VGap=12, HGap=5, MaxCols=2) # Add the fields # Connection Dropdown cap = dui.dLabel(self.bg, Caption=_("Connection")) ctl = dui.dDropdownList(self.bg, Choices=self.connDict.keys(), RegID="connectionSelector", OnHit=self.onConnectionChange) btn = dui.dButton(self.bg, Caption=_("Edit Name"), RegID="cxnEdit", OnHit=self.onCxnEdit) hsz = dui.dSizer("h") hsz.append(ctl) hsz.appendSpacer(10) hsz.append(btn) btn = dui.dButton(self.bg, Caption=_("Delete This Connection"), RegID="cxnDelete", DynamicEnabled=self.hasMultipleConnections, OnHit=self.onCxnDelete) hsz.appendSpacer(10) hsz.append(btn) gbsz.append(cap, halign="right", valign="middle") gbsz.append(hsz, valign="middle") # Backend Type cap = dui.dLabel(self.bg, Caption=_("Database Type")) ctl = dui.dDropdownList(self.bg, RegID="DbType", Choices=["MySQL", "Firebird", "PostgreSQL", "MsSQL", "SQLite"], DataSource="form", DataField="dbtype", OnHit=self.onDbTypeChanged) gbsz.append(cap, halign="right") gbsz.append(ctl) self.dbTypeSelector = ctl # Host cap = dui.dLabel(self.bg, Caption=_("Host")) ctl = dui.dTextBox(self.bg, DataSource="form", DataField="host") gbsz.append(cap, halign="right") gbsz.append(ctl, "expand") self.hostText = ctl # Port cap = dui.dLabel(self.bg, Caption=_("Port")) ctl = dui.dTextBox(self.bg, DataSource="form", DataField="port") gbsz.append(cap, halign="right") gbsz.append(ctl, "expand") self.portText = ctl # Database cap = dui.dLabel(self.bg, Caption=_("Database")) ctl = dui.dTextBox(self.bg, DataSource="form", DataField="database") hsz = dui.dSizer("h") self.btnDbSelect = dui.dButton(self.bg, Caption=" ... ", RegID="btnDbSelect", Visible=False, OnHit=self.onDbSelect) hsz.append1x(ctl) hsz.appendSpacer(2) hsz.append(self.btnDbSelect, 0, "x") gbsz.append(cap, halign="right") gbsz.append(hsz, "expand") self.dbText = ctl # Username cap = dui.dLabel(self.bg, Caption=_("User Name")) ctl = dui.dTextBox(self.bg, DataSource="form", DataField="user") gbsz.append(cap, halign="right") gbsz.append(ctl, "expand") self.userText = ctl # Password cap = dui.dLabel(self.bg, Caption=_("Password")) ctl = dui.dTextBox(self.bg, PasswordEntry=True, DataSource="form", DataField="password") gbsz.append(cap, halign="right") gbsz.append(ctl, "expand") self.pwText = ctl # Open Button btnSizer1 = dui.dSizer("h") btnSizer2 = dui.dSizer("h") btnTest = dui.dButton(self.bg, RegID="btnTest", Caption=_("Test..."), OnHit=self.onTest) btnSave = dui.dButton(self.bg, RegID="btnSave", Caption=_("Save"), OnHit=self.onSave) btnNewConn = dui.dButton(self.bg, RegID="btnNewConn", Caption=_("New Connection"), OnHit=self.onNewConn) btnNewFile = dui.dButton(self.bg, RegID="btnNewFile", Caption=_("New File"), OnHit=self.onNewFile) btnOpen = dui.dButton(self.bg, RegID="btnOpen", Caption=_("Open File..."), OnHit=self.onOpen) btnSizer1.append(btnTest, 0, border=3) btnSizer1.append(btnSave, 0, border=3) btnSizer2.append(btnNewConn, 0, border=3) btnSizer2.append(btnNewFile, 0, border=3) btnSizer2.append(btnOpen, 0, border=3) gbsz.setColExpand(True, 1) self.gridSizer = gbsz sz = self.bg.Sizer = dui.dSizer("v") sz.append(gbsz, 0, "expand", halign="center", border=20) sz.append(btnSizer1, 0, halign="center") sz.append(btnSizer2, 0, halign="center") # Only create the 'Set Crypto Key' button if PyCrypto is installed try: from Crypto.Cipher import DES3 as _TEST_DES3 self._showKeyButton = True del _TEST_DES3 except ImportError: self._showKeyButton = False if self._showKeyButton: self.cryptoKeyButton = dui.dButton(self.bg, Caption=_("Set Crypto Key"), OnHit=self.onSetCrypto) btnSizer1.append(self.cryptoKeyButton, 0, halign="center", border=3) self.Sizer = dui.dSizer("h") self.Sizer.append(self.bg, 1, "expand", halign="center") self.Layout()