def __build_tabcontrol(self): ''' builds and returns the TabControl for this dialog ''' tabcontrol = TabControl() tabcontrol.Location = Point(10, 15) tabcontrol.Size = Size(395, 302) tabcontrol.Controls.Add( self.__build_comicvinetab() ) tabcontrol.Controls.Add( self.__build_detailstab() ) tabcontrol.Controls.Add( self.__build_behaviourtab() ) tabcontrol.Controls.Add( self.__build_datatab() ) tabcontrol.Controls.Add( self.__build_advancedtab() ) return tabcontrol
def __build_tabcontrol(self): ''' builds and returns the TabControl for this dialog ''' tabcontrol = TabControl() tabcontrol.Location = Point(10, 15) tabcontrol.Size = Size(395, 302) tabcontrol.Controls.Add(self.__build_comicvinetab()) tabcontrol.Controls.Add(self.__build_detailstab()) tabcontrol.Controls.Add(self.__build_behaviourtab()) tabcontrol.Controls.Add(self.__build_datatab()) tabcontrol.Controls.Add(self.__build_advancedtab()) return tabcontrol
def init(self): # tabs tabs = TabControl() tabs.Size = Size(580, 700) tabs.Location = Point(10, 10) # buttons ok = Button() ok.Text = 'OK' ok.DialogResult = DialogResult.OK cancel = Button() cancel.Text = 'Cancel' cancel.DialogResult = DialogResult.Cancel buttons = FlowLayoutPanel() buttons.FlowDirection = FlowDirection.RightToLeft buttons.BorderStyle = BorderStyle.None buttons.Controls.Add(cancel) buttons.Controls.Add(ok) buttons.Size = Size(580, 30) buttons.Location = Point(10, 720) self.ClientSize = Size(600, 800) self.Controls.Add(tabs) self.Controls.Add(buttons) # pages and tables index = 0 for name in self.settings: page = make_page(name, name, index) page.TabIndex = index settings = self.settings[name] table = make_table(name) table.ColumnCount = 2 table.Columns[0].Name = 'Key' table.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable table.Columns[0].ReadOnly = True table.Columns[ 0].DefaultCellStyle.SelectionBackColor = Color.FromArgb( 238, 238, 238) table.Columns[0].DefaultCellStyle.BackColor = Color.FromArgb( 238, 238, 238) table.Columns[1].Name = 'Value' table.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable keys = sorted(settings.keys()) for key in keys: table.Rows.Add(key, settings[key]) page.Controls.Add(table) tabs.Controls.Add(page) self.tables[name] = table index += 1
def _add_tabs(self): self.tabs = TabControl() self.tabs.Size = Size(580, 700) self.tabs.Location = Point(10, 10) self.Controls.Add(self.tabs)
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)