def __createGeneralControls(self): # Page title self.titleLabel = wx.StaticText(self, label=_('Title')) self.titleTextCtrl = wx.TextCtrl(self, value='') self.titleTextCtrl.SetMinSize((350, -1)) # Page icon self.iconBtn = wx.BitmapButton(self) self.iconBtn.SetMinSize((40, -1)) self.iconBtn.SetToolTip(_('Page icon')) self.iconsPopup = IconsListPopup(self) self.iconsPopup.SetSize((self._POPUP_WIDTH, self._POPUP_HEIGHT)) # Page type self.typeLabel = wx.StaticText(self, label=_('Page type')) self.typeCombo = wx.ComboBox(self, choices=[], style=wx.CB_DROPDOWN | wx.CB_READONLY) # Page order self.orderLabel = wx.StaticText(self, label=_('New page position')) self.orderCombo = wx.ComboBox(self, choices=[], style=wx.CB_DROPDOWN | wx.CB_READONLY) # Tags self.tagsSelector = TagsSelector(self)
def __createGeneralControls(self): self.titleLabel = wx.StaticText(self, -1, _(u"Title")) self.titleTextCtrl = wx.TextCtrl(self, value="") self.titleTextCtrl.SetMinSize((350, -1)) self.typeCombo = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_READONLY) self.tagsSelector = TagsSelector(self) self.typeLabel = wx.StaticText(self, -1, _(u"Page type"))
def __createGeneralControls(self): # Page alias self.titleLabel = wx.StaticText(self, label=_(u"Title")) self.titleTextCtrl = wx.TextCtrl(self, value="") self.titleTextCtrl.SetMinSize((350, -1)) # Page type self.typeLabel = wx.StaticText(self, label=_(u"Page type")) self.typeCombo = wx.ComboBox(self, choices=[], style=wx.CB_DROPDOWN | wx.CB_READONLY) # Page order self.orderLabel = wx.StaticText(self, label=_('New page position')) self.orderCombo = wx.ComboBox(self, choices=[], style=wx.CB_DROPDOWN | wx.CB_READONLY) # Tags self.tagsSelector = TagsSelector(self)
def _addTagsList(self, mainSizer): self.tagsSelector = TagsSelector(self) mainSizer.Add(self.tagsSelector, 0, wx.EXPAND, 0)
class DownloadDialog(TestedDialog): def __init__(self, parent): super(DownloadDialog, self).__init__(parent) global _ _ = get_() self._createGui() self.urlText.SetFocus() def _createGui(self): mainSizer = wx.FlexGridSizer(cols=1) mainSizer.AddGrowableCol(0) mainSizer.AddGrowableRow(1) mainSizer.AddGrowableRow(2) self._addUrlGui(mainSizer) self._addTagsList(mainSizer) self._addLogGui(mainSizer) self._addOkCancel(mainSizer) self.SetSizer(mainSizer) self.SetTitle(_('Download web page')) self.SetMinSize((500, 350)) self.Fit() def _addUrlGui(self, mainSizer): urlSizer = wx.FlexGridSizer(cols=3) urlSizer.AddGrowableCol(1) urlLabel = wx.StaticText(self, label=_('URL or local file')) self.urlText = wx.TextCtrl(self) self.selectFileButton = wx.Button(self, label=_('...')) self.selectFileButton.SetMinSize((30, -1)) urlSizer.Add(urlLabel, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, border=4) urlSizer.Add(self.urlText, 0, wx.ALL | wx.EXPAND, border=2) urlSizer.Add(self.selectFileButton, 0, wx.ALL | wx.ALIGN_RIGHT, border=2) mainSizer.Add(urlSizer, 0, wx.ALL | wx.EXPAND, border=2) def _addTagsList(self, mainSizer): self.tagsSelector = TagsSelector(self) mainSizer.Add(self.tagsSelector, 0, wx.EXPAND, 0) def _addLogGui(self, mainSizer): self.logText = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE) self.logText.SetMinSize((-1, 100)) mainSizer.Add(self.logText, 0, wx.EXPAND, 0) def _addOkCancel(self, mainSizer): buttonsSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) mainSizer.Add(buttonsSizer, 0, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM | wx.ALL, border=4) def setTagsList(self, tagslist): self.tagsSelector.setTagsList(tagslist) @property def url(self): return self.urlText.Value.strip() @url.setter def url(self, url): self.urlText.Value = url @property def tags(self): return self.tagsSelector.tags @tags.setter def tags(self, tags): self.tagsSelector.tags = tags
class DownloadDialog(TestedDialog): def __init__(self, parent): super(DownloadDialog, self).__init__(parent) global _ _ = get_() self._createGui() self.urlText.SetFocus() def _createGui(self): mainSizer = wx.FlexGridSizer(cols=1) mainSizer.AddGrowableCol(0) mainSizer.AddGrowableRow(1) mainSizer.AddGrowableRow(2) self._addUrlGui(mainSizer) self._addTagsList(mainSizer) self._addLogGui(mainSizer) self._addOkCancel(mainSizer) self.SetSizer(mainSizer) self.SetTitle(_(u'Download web page')) self.SetMinSize((500, 350)) self.Fit() def _addUrlGui(self, mainSizer): urlSizer = wx.FlexGridSizer(cols=3) urlSizer.AddGrowableCol(1) urlLabel = wx.StaticText(self, label=_(u'URL or local file')) self.urlText = wx.TextCtrl(self) self.selectFileButton = wx.Button(self, label=_(u'...')) self.selectFileButton.SetMinSize((30, -1)) urlSizer.Add(urlLabel, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, border=4) urlSizer.Add(self.urlText, 0, wx.ALL | wx.EXPAND, border=2) urlSizer.Add(self.selectFileButton, 0, wx.ALL | wx.ALIGN_RIGHT, border=2) mainSizer.Add(urlSizer, 0, wx.ALL | wx.EXPAND, border=2) def _addTagsList(self, mainSizer): self.tagsSelector = TagsSelector(self) mainSizer.Add(self.tagsSelector, 0, wx.EXPAND, 0) def _addLogGui(self, mainSizer): self.logText = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE) self.logText.SetMinSize((-1, 100)) mainSizer.Add(self.logText, 0, wx.EXPAND, 0) def _addOkCancel(self, mainSizer): buttonsSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) mainSizer.Add(buttonsSizer, 0, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM | wx.ALL, border=4) def setTagsList(self, tagslist): self.tagsSelector.setTagsList(tagslist) @property def url(self): return self.urlText.Value.strip() @url.setter def url(self, url): self.urlText.Value = url @property def tags(self): return self.tagsSelector.tags @tags.setter def tags(self, tags): self.tagsSelector.tags = tags