def __build_advancedtab(self): ''' builds and returns the "Advanced" Tab for the TabControl ''' tabpage = TabPage() tabpage.Text = i18n.get("ConfigFormAdvancedTab") # 1. --- a description label for this tabpage label = Label() label.UseMnemonic = False label.AutoSize = True label.Location = Point(14, 25) label.Size = Size(299, 17) label.Text = i18n.get("ConfigFormAdvancedText") # 2. --- build the update checklist (contains all the 'data' checkboxes) tbox = RichTextBox() tbox.Multiline = True tbox.MaxLength = 65536 tbox.WordWrap = True tbox.Location = Point(15, 50) tbox.Size = Size(355, 200) menu = ContextMenu() items = menu.MenuItems items.Add(MenuItem(i18n.get("TextCut"), lambda s, ea: tbox.Cut())) items.Add(MenuItem(i18n.get("TextCopy"), lambda s, ea: tbox.Copy())) items.Add(MenuItem(i18n.get("TextPaste"), lambda s, ea: tbox.Paste())) tbox.ContextMenu = menu self.__advanced_tbox = tbox # 3. --- add 'em all to the tabpage tabpage.Controls.Add(label) tabpage.Controls.Add(self.__advanced_tbox) return tabpage
def make_page(name, title, index, padding=0): page = TabPage() page.BackColor = Color.White page.Dock = DockStyle.Fill page.Padding = Padding(padding) page.TabIndex = index page.Text = title return page
def add_page(self, index, name, title, padding=0): page = TabPage() page.BackColor = Color.White page.Dock = DockStyle.Fill page.Padding = Padding(padding) page.TabIndex = index page.Text = title self.tabs.Controls.Add(page)
def __build_comicvinetab(self): ''' builds and returns the "ComicVine" Tab for the TabControl ''' tabpage = TabPage() tabpage.Text = i18n.get("ConfigFormComicVineTab") tabpage.Name = "comicvine" # 1. --- a description label for this tabpage label = Label() label.UseMnemonic = False label.AutoSize = False label.Location = Point(34, 80) label.Size = Size(315, 54) label.Text = i18n.get("ConfigFormComicVineText") # 2. --- the API key text box fired_update_gui = self.__fired_update_gui class ApiKeyTextBox(TextBox): def OnTextChanged(self, args): fired_update_gui() self.__api_key_tbox = ApiKeyTextBox() tbox = self.__api_key_tbox tbox.Location = Point(34, 135) tbox.Size = Size(315, 1) menu = ContextMenu() items = menu.MenuItems items.Add(MenuItem(i18n.get("TextCut"), lambda s, ea: tbox.Cut())) items.Add(MenuItem(i18n.get("TextCopy"), lambda s, ea: tbox.Copy())) items.Add(MenuItem(i18n.get("TextPaste"), lambda s, ea: tbox.Paste())) tbox.ContextMenu = menu # 3. --- add a clickable link to send the user to ComicVine linklabel = LinkLabel() linklabel.UseMnemonic = False linklabel.AutoSize = False linklabel.Location = Point(34, 170) linklabel.Size = Size(315, 34) linklabel.Text = i18n.get("ConfigFormComicVineClickHere") linklabel.LinkClicked += self.__fired_linkclicked # 4. --- add 'em all to this tabpage tabpage.Controls.Add(label) tabpage.Controls.Add(tbox) tabpage.Controls.Add(linklabel) return tabpage
def __build_datatab(self): ''' builds and returns the "Data" Tab for the TabControl ''' tabpage = TabPage() tabpage.Text = i18n.get("ConfigFormDataTab") # 1. --- build the 'convert imprints checkbox' self.__convert_imprints_cb = CheckBox() self.__convert_imprints_cb.AutoSize = False self.__convert_imprints_cb.FlatStyle = FlatStyle.System self.__convert_imprints_cb.Location = Point(52, 35) self.__convert_imprints_cb.Size = Size(300, 34) self.__convert_imprints_cb.Text = i18n.get("ConfigFormImprintsCB") self.__convert_imprints_cb.CheckedChanged += self.__fired_update_gui # 2. -- build the 'overwrite existing' checkbox self.__ow_existing_cb = CheckBox() self.__ow_existing_cb.AutoSize = False self.__ow_existing_cb.FlatStyle = FlatStyle.System self.__ow_existing_cb.Location = Point(52, 85) self.__ow_existing_cb.Size = Size(310, 34) self.__ow_existing_cb.Text = i18n.get("ConfigFormOverwriteCB") self.__ow_existing_cb.CheckedChanged += self.__fired_update_gui # 3. --- build the 'ignore blanks' checkbox self.__ignore_blanks_cb = CheckBox() self.__ignore_blanks_cb.AutoSize = False self.__ignore_blanks_cb.FlatStyle = FlatStyle.System self.__ignore_blanks_cb.Location = Point(82, 125) self.__ignore_blanks_cb.Size = Size(270, 34) self.__ignore_blanks_cb.TextAlign = ContentAlignment.TopLeft self.__ignore_blanks_cb.Text = i18n.get("ConfigFormOverwriteEmptyCB") self.__ignore_blanks_cb.CheckedChanged += self.__fired_update_gui # 4. --- build the 'download thumbnails' checkbox self.__download_thumbs_cb = CheckBox() self.__download_thumbs_cb.AutoSize = False self.__download_thumbs_cb.FlatStyle = FlatStyle.System self.__download_thumbs_cb.Location = Point(52, 165) self.__download_thumbs_cb.Size = Size(300, 34) self.__download_thumbs_cb.Text = i18n.get("ConfigFormFilelessCB") self.__download_thumbs_cb.CheckedChanged += self.__fired_update_gui # 5. --- build the 'preserve thumbnails' checkbox self.__preserve_thumbs_cb = CheckBox() self.__preserve_thumbs_cb.AutoSize = False self.__preserve_thumbs_cb.FlatStyle = FlatStyle.System self.__preserve_thumbs_cb.Location = Point(82, 205) self.__preserve_thumbs_cb.Size = Size(270, 34) self.__preserve_thumbs_cb.TextAlign = ContentAlignment.TopLeft self.__preserve_thumbs_cb.Text = i18n.get( "ConfigFormFilelessOverwriteCB") self.__preserve_thumbs_cb.CheckedChanged += self.__fired_update_gui # 6. --- add 'em all to the tabpage tabpage.Controls.Add(self.__ow_existing_cb) tabpage.Controls.Add(self.__ignore_blanks_cb) tabpage.Controls.Add(self.__convert_imprints_cb) tabpage.Controls.Add(self.__download_thumbs_cb) tabpage.Controls.Add(self.__preserve_thumbs_cb) return tabpage
def __build_behaviourtab(self): ''' builds and returns the "Behaviour" Tab for the TabControl ''' tabpage = TabPage() tabpage.Text = i18n.get("ConfigFormBehaviourTab") # 1. --- build the 'When scraping for the first time' label first_scrape_label = Label() first_scrape_label.AutoSize = False first_scrape_label.FlatStyle = FlatStyle.System first_scrape_label.Location = Point(52, 27) first_scrape_label.Text = i18n.get("ConfigFormFirstScrapeLabel") first_scrape_label.Size = Size(300, 17) # 1. --- build the 'autochoose series' checkbox self.__autochoose_series_cb = CheckBox() self.__autochoose_series_cb.AutoSize = False self.__autochoose_series_cb.FlatStyle = FlatStyle.System self.__autochoose_series_cb.Location = Point(82, 45) self.__autochoose_series_cb.Size = Size(300, 34) self.__autochoose_series_cb.Text = i18n.get( "ConfigFormAutochooseSeriesCB") self.__autochoose_series_cb.CheckedChanged += self.__fired_update_gui # 2. --- build the 'confirm issue' checkbox self.__confirm_issue_cb = CheckBox() self.__confirm_issue_cb.AutoSize = False self.__confirm_issue_cb.FlatStyle = FlatStyle.System self.__confirm_issue_cb.Location = Point(82, 75) self.__confirm_issue_cb.Size = Size(300, 34) self.__confirm_issue_cb.Text = i18n.get("ConfigFormConfirmIssueCB") self.__confirm_issue_cb.CheckedChanged += self.__fired_update_gui # 3. -- build the 'use fast rescrape' checkbox self.__fast_rescrape_cb = CheckBox() self.__fast_rescrape_cb.AutoSize = False self.__fast_rescrape_cb.FlatStyle = FlatStyle.System self.__fast_rescrape_cb.Location = Point(52, 116) self.__fast_rescrape_cb.Size = Size(300, 34) self.__fast_rescrape_cb.Text = i18n.get("ConfigFormRescrapeCB") self.__fast_rescrape_cb.CheckedChanged += self.__fired_update_gui # 4. -- build the 'add rescrape hints to notes' checkbox self.__rescrape_notes_cb = CheckBox() self.__rescrape_notes_cb.AutoSize = False self.__rescrape_notes_cb.FlatStyle = FlatStyle.System self.__rescrape_notes_cb.Location = Point(82, 151) self.__rescrape_notes_cb.Size = Size(270, 17) self.__rescrape_notes_cb.Text = i18n.get("ConfigFormRescrapeNotesCB") self.__rescrape_notes_cb.CheckedChanged += self.__fired_update_gui # 5. -- build the 'add rescrape hints to tags' checkbox self.__rescrape_tags_cb = CheckBox() self.__rescrape_tags_cb.AutoSize = False self.__rescrape_tags_cb.FlatStyle = FlatStyle.System self.__rescrape_tags_cb.Location = Point(82, 181) self.__rescrape_tags_cb.Size = Size(270, 17) self.__rescrape_tags_cb.Text = i18n.get("ConfigFormRescrapeTagsCB") self.__rescrape_tags_cb.CheckedChanged += self.__fired_update_gui # 6. --- build the 'specify series name' checkbox self.__summary_dialog_cb = CheckBox() self.__summary_dialog_cb.AutoSize = False self.__summary_dialog_cb.FlatStyle = FlatStyle.System self.__summary_dialog_cb.Location = Point(52, 214) self.__summary_dialog_cb.Size = Size(300, 34) self.__summary_dialog_cb.Text = i18n.get("ConfigFormShowSummaryCB") self.__summary_dialog_cb.CheckedChanged += self.__fired_update_gui # 7. --- add 'em all to the tabpage tabpage.Controls.Add(first_scrape_label) tabpage.Controls.Add(self.__autochoose_series_cb) tabpage.Controls.Add(self.__confirm_issue_cb) tabpage.Controls.Add(self.__fast_rescrape_cb) tabpage.Controls.Add(self.__rescrape_tags_cb) tabpage.Controls.Add(self.__rescrape_notes_cb) tabpage.Controls.Add(self.__summary_dialog_cb) return tabpage
def __build_detailstab(self): ''' builds and returns the "Details" Tab for the TabControl ''' tabpage = TabPage() tabpage.Text = i18n.get("ConfigFormDetailsTab") tabpage.Name = "details" # 1. --- a description label for this tabpage label = Label() label.UseMnemonic = False label.AutoSize = True label.Location = Point(14, 35) label.Size = Size(299, 17) label.Text = i18n.get("ConfigFormDetailsText") # 2. --- the 'select all' button checkall_button = Button() checkall_button.Click += self.__fired_checkall checkall_button.Location = Point(280, 107) checkall_button.Size = Size(100, 23) checkall_button.Text = i18n.get("ConfigFormDetailsAll") # 3. --- the 'deselect all' button uncheckall_button = Button() uncheckall_button.Click += self.__fired_uncheckall uncheckall_button.Location = Point(280, 138) uncheckall_button.Size = Size(100, 23) uncheckall_button.Text = i18n.get("ConfigFormDetailsNone") # 4. --- build the update checklist (contains all the 'data' checkboxes) self.__update_checklist = CheckedListBox() self.__update_checklist.CheckOnClick = True self.__update_checklist.ColumnWidth = 125 self.__update_checklist.ThreeDCheckBoxes = True self.__update_checklist.Location = Point(15, 65) self.__update_checklist.MultiColumn = True self.__update_checklist.SelectionMode = SelectionMode.One self.__update_checklist.Size = Size(260, 170) self.__update_checklist.ItemCheck += self.__fired_update_gui self.__update_checklist.Items.Add(ConfigForm.__SERIES_CB) self.__update_checklist.Items.Add(ConfigForm.__VOLUME_CB) self.__update_checklist.Items.Add(ConfigForm.__NUMBER_CB) self.__update_checklist.Items.Add(ConfigForm.__TITLE_CB) self.__update_checklist.Items.Add(ConfigForm.__PUBLISHED_CB) self.__update_checklist.Items.Add(ConfigForm.__RELEASED_CB) self.__update_checklist.Items.Add(ConfigForm.__CROSSOVERS_CB) self.__update_checklist.Items.Add(ConfigForm.__PUBLISHER_CB) self.__update_checklist.Items.Add(ConfigForm.__IMPRINT_CB) self.__update_checklist.Items.Add(ConfigForm.__WRITER_CB) self.__update_checklist.Items.Add(ConfigForm.__PENCILLER_CB) self.__update_checklist.Items.Add(ConfigForm.__INKER_CB) self.__update_checklist.Items.Add(ConfigForm.__COLORIST_CB) self.__update_checklist.Items.Add(ConfigForm.__LETTERER_CB) self.__update_checklist.Items.Add(ConfigForm.__COVER_ARTIST_CB) self.__update_checklist.Items.Add(ConfigForm.__EDITOR_CB) self.__update_checklist.Items.Add(ConfigForm.__SUMMARY_CB) self.__update_checklist.Items.Add(ConfigForm.__CHARACTERS_CB) self.__update_checklist.Items.Add(ConfigForm.__TEAMS_CB) self.__update_checklist.Items.Add(ConfigForm.__LOCATIONS_CB) self.__update_checklist.Items.Add(ConfigForm.__WEBPAGE_CB) # 5. --- add 'em all to this tabpage tabpage.Controls.Add(label) tabpage.Controls.Add(checkall_button) tabpage.Controls.Add(uncheckall_button) tabpage.Controls.Add(self.__update_checklist) return tabpage
def InitializeComponent(self): self.ScannerNames = ListBox() self.Blacklist = ListBox() self.Add = Button() self.Remove = Button() self.Prefix = TextBox() self.Unknown = TextBox() self.lblunknown = Label() self.lblprefix = Label() self.Okay = Button() self.Tabs = TabControl() self.ScannersTab = TabPage() self.BlacklistTab = TabPage() # # ScannerNames # self.ScannerNames.BorderStyle = BorderStyle.None self.ScannerNames.Dock = DockStyle.Fill self.ScannerNames.TabIndex = 0 self.ScannerNames.Sorted = True # # Blacklist # self.Blacklist.Dock = DockStyle.Fill self.Blacklist.TabIndex = 0 self.Blacklist.Sorted = True self.Blacklist.BorderStyle = BorderStyle.None # # Add # self.Add.Location = Point(228, 102) self.Add.Size = Size(75, 23) self.Add.Text = "Add" self.Add.Click += self.AddItem # # Remove # self.Remove.Location = Point(228, 162) self.Remove.Size = Size(75, 23) self.Remove.Text = "Remove" self.Remove.Click += self.RemoveItem # # Prefix # self.Prefix.Location = Point(76, 313) self.Prefix.Size = Size(136, 20) # # lblprefix # self.lblprefix.AutoSize = True self.lblprefix.Location = Point(12, 316) self.lblprefix.Size = Size(58, 13) self.lblprefix.Text = "Tag Prefix:" # # Unknown # self.Unknown.Location = Point(90, 337) self.Unknown.Size = Size(122, 20) # # lblprefix # self.lblunknown.AutoSize = True self.lblunknown.Location = Point(12, 340) self.lblunknown.Size = Size(58, 13) self.lblunknown.Text = "Unknown Tag:" # # Okay # self.Okay.Location = Point(228, 339) self.Okay.Size = Size(75, 23) self.Okay.Text = "Okay" self.Okay.DialogResult = DialogResult.OK # # ScannersTab # self.ScannersTab.Text = "Scanners" self.ScannersTab.UseVisualStyleBackColor = True self.ScannersTab.Controls.Add(self.ScannerNames) # # BlacklistTab # self.BlacklistTab.Text = "Blacklist" self.BlacklistTab.UseVisualStyleBackColor = True self.BlacklistTab.Controls.Add(self.Blacklist) # # Tabs # self.Tabs.Size = Size(210, 280) self.Tabs.Location = Point(12, 12) self.Tabs.Controls.Add(self.ScannersTab) self.Tabs.Controls.Add(self.BlacklistTab) # # Form Settings # self.Size = System.Drawing.Size(315, 400) self.Controls.Add(self.Tabs) self.Controls.Add(self.Add) self.Controls.Add(self.Remove) self.Controls.Add(self.lblprefix) self.Controls.Add(self.Prefix) self.Controls.Add(self.lblunknown) self.Controls.Add(self.Unknown) self.Controls.Add(self.Okay) self.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent self.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog self.Text = "Scan Information From Filename Options" self.MinimizeBox = False self.MaximizeBox = False self.AcceptButton = self.Okay self.Icon = System.Drawing.Icon(ICON)
def __init__(self, collectionsManager, moduleManager, currentCollection): Panel.__init__(self) self.collections = collectionsManager self.Dock = DockStyle.Fill self.Font = UIGlobal.normalFont # -- Collections and module lists self.collectionsList = CollectionsList() self.modulesList = CollectionsModuleList() self.currentCollection = currentCollection # -- Load the collections list self.itemToSetAsSelected = None for c in self.collections.Names(): item = self.collectionsList.AddCollection(c) if c == currentCollection: self.itemToSetAsSelected = item # -- Handlers self.collectionsList.SetSelectedHandler(self.__OnCollectionSelected) self.collectionsList.AfterLabelEdit += self.__OnCollectionRenamed # -- Modules list and info self.moduleBrowser = ModuleBrowser(moduleManager) self.moduleBrowser.SetActivatedHandler(self.__OnModuleActivated) # -- Toolbar self.toolbar = CollectionsToolbar() self.toolbar.ButtonClick += self.__ToolbarButtonHandler self.collectionsList.GotFocus += self.__ChangeOfFocusHandler self.collectionsList.LostFocus += self.__ChangeOfFocusHandler self.modulesList.GotFocus += self.__ChangeOfFocusHandler self.modulesList.LostFocus += self.__ChangeOfFocusHandler self.moduleBrowser.moduleTree.GotFocus += self.__ChangeOfFocusHandler self.moduleBrowser.moduleTree.LostFocus += self.__ChangeOfFocusHandler # -- Put it all together self.splitContainer1 = SplitContainer() self.splitContainer1.Dock = DockStyle.Fill self.splitContainer1.TabIndex = 1 self.splitContainer1.SplitterWidth = UIGlobal.SPLITTER_WIDTH self.splitContainer1.SplitterDistance = 50 self.splitContainer1.Orientation = Orientation.Vertical self.splitContainer1.Panel1.Controls.Add(self.collectionsList) self.splitContainer1.Panel2.Controls.Add(self.modulesList) self.collectionsTabPage = TabPage() self.collectionsTabPage.Controls.Add(self.splitContainer1) self.collectionsTabPage.Text = "Collections" self.collectionsTabControl = TabControl() self.collectionsTabControl.Dock = DockStyle.Fill self.collectionsTabControl.Alignment = TabAlignment.Left self.collectionsTabControl.TabStop = False self.collectionsTabControl.TabPages.Add(self.collectionsTabPage) self.modulesTabPage = TabPage() self.modulesTabPage.Controls.Add(self.moduleBrowser) self.modulesTabPage.Text = "Modules" self.modulesTabControl = TabControl() self.modulesTabControl.Dock = DockStyle.Fill self.modulesTabControl.Alignment = TabAlignment.Left self.modulesTabControl.TabStop = False self.modulesTabControl.TabPages.Add(self.modulesTabPage) self.splitContainer2 = SplitContainer() self.splitContainer2.Dock = DockStyle.Fill self.splitContainer2.TabIndex = 2 self.splitContainer2.SplitterWidth = UIGlobal.SPLITTER_WIDTH self.splitContainer2.SplitterDistance = 30 self.splitContainer2.Orientation = Orientation.Horizontal self.splitContainer2.Panel1.Controls.Add(self.collectionsTabControl) self.splitContainer2.Panel2.Controls.Add(self.modulesTabControl) ## Add the main SplitContainer control to the panel. self.Controls.Add(self.splitContainer2) self.Controls.Add(self.toolbar) # Last in takes space priority
def __init__(self): """TabControlTabPageSample class init function.""" # setup title self.Text = "TabControl & TabPage control" # add items self.label1 = Label() self.label1.Text = "I'm in tab page 0" self.label1.AutoSize = True self.label1.Location = Point(5, 20) self.label2 = Label() self.label2.Text = "I'm in tab page 1" self.label2.AutoSize = True self.label2.Location = Point(5, 20) self.label3 = Label() self.label3.Text = "I'm in tab page 2" self.label3.AutoSize = True self.label3.Location = Point(5, 20) self.label4 = Label() self.label4.Text = "I'm in tab page 3" self.label4.AutoSize = True self.label4.Location = Point(5, 20) self.label5 = Label() self.label5.Text = "I'm in tab page 4" self.label5.AutoSize = True self.label5.Location = Point(5, 20) self.label6 = Label() self.label6.Text = "I'm in tab page 5" self.label6.AutoSize = True self.label6.Location = Point(5, 20) self.label7 = Label() self.label7.Text = "I'm in tab page 6" self.label7.AutoSize = True self.label7.Location = Point(5, 20) self.diclabels = { 0: self.label1, 1: self.label2, 2: self.label3, 3: self.label4, 4: self.label5, 5: self.label6, 6: self.label7, 7: self.label7, 8: self.label7, 9: self.label7, } self.button = Button() self.button.Text = "Button" self.button.Location = Point(5, 60) self.count = 0 self.button.Click += self.button_click self.textbox = TextBox() self.textbox.Text = "TextBox" self.textbox.Location = Point(5, 60) self.textbox.TextChanged += self.textbox_click self.checkbox = CheckBox() self.checkbox.Text = "CheckBox" self.checkbox.Location = Point(5, 60) self.checkbox.Click += self.checkbox_click self.radiobutton = RadioButton() self.radiobutton.Text = "RadioButton" self.radiobutton.Location = Point(5, 60) self.radiobutton.CheckedChanged += self.radiobutton_click self.radiobutton1 = RadioButton() self.radiobutton1.Text = "RadioButton" self.radiobutton1.Location = Point(5, 60) self.radiobutton2 = RadioButton() self.radiobutton2.Text = "RadioButton" self.radiobutton2.Location = Point(5, 60) self.radiobutton3 = RadioButton() self.radiobutton3.Text = "RadioButton" self.radiobutton3.Location = Point(5, 60) self.dicitems = { 0: self.button, 1: self.textbox, 2: self.checkbox, 3: self.radiobutton, 4: self.radiobutton1, 5: self.radiobutton2, 6: self.radiobutton3, 7: self.radiobutton3, 8: self.radiobutton3, 9: self.radiobutton3, } # setup tabcontrol self.tabcontrol = TabControl() self.tabcontrol.Width = 200 self.tabcontrol.Height = 240 # setup tabpage for i in range(10): self.tabpage = TabPage() self.tabpage.Text = "Tab %s" % i self.tabpage.Enter += self.on_click self.tabpage.Controls.Add(self.diclabels[i]) self.tabpage.Controls.Add(self.dicitems[i]) # add controls self.tabcontrol.TabPages.Add(self.tabpage) # setup status bar self.statusbar = StatusBar() self.statusbar_panel = StatusBarPanel() self.statusbar_panel.BorderStyle = StatusBarPanelBorderStyle.Sunken self.statusbar_panel.Text = "Select a Tab" self.statusbar_panel.AutoSize = StatusBarPanelAutoSize.Spring self.statusbar.ShowPanels = True # add controls self.statusbar.Panels.Add(self.statusbar_panel) self.Controls.Add(self.statusbar) self.Controls.Add(self.tabcontrol)