def __init__(self): print("Create Page2") startX = 30 self.Text = "Program2 (Page2)" self.Width = 440 self.Height = 620 self.cameraPanel = Panel() self.cameraPanel.Width = 360 self.cameraPanel.Height = 360 self.cameraPanel.Location = Point(30, 30) self.cameraPanel.BorderStyle = BorderStyle.FixedSingle self.lblLabel = Label() self.lblLabel.Width = 360 self.lblLabel.Height = 50 self.lblLabel.Location = Point(30, 400) self.lblLabel.BorderStyle = BorderStyle.FixedSingle self.statusContainer = Panel() self.statusContainer.Width = 310 self.statusContainer.Height = 100 self.statusContainer.Location = Point(30, 460) self.statusContainer.BorderStyle = BorderStyle.FixedSingle self.initHeaderForStatusPanel() self.statusContainer.Controls.Add(self.headerStatusPanel) self.btnPrint = Button() self.btnPrint.Width = 45 self.btnPrint.Height = 100 self.btnPrint.Location = Point(345, 460) self.btnPrint.Text = "Print" self.btnPrint.TextAlign = ContentAlignment.MiddleCenter self.initStatusContainer() self.initStatusPanel() # for x in range(10): # databaseRow = TBL_Generator.StatusRow(self, "Chatchawan", str(12345 + x), "2/2", "OK") # self.statusPanel.Controls.Add(databaseRow) self.statusContainer.Controls.Add(self.statusPanel) self.Controls.Add(self.cameraPanel) self.Controls.Add(self.lblLabel) self.Controls.Add(self.statusContainer) self.Controls.Add(self.btnPrint) self.inThreadObjDec = internalThreadCallObjDetection() self.inThreadObjDec.start() self.inThreadUpdateCtrls = internalThreadUpdateControls( self.statusPanel) self.inThreadUpdateCtrls.start() print('Create subprocess finish') self.FormClosed += self.formClose
def __init__(self): self.Text = "Example App" self.Name = "ExampleApp" self.ClientSize = Size(370, 400) self.MinimumSize = Size(370, 300) self._table = DataTable() self._columns = { d[0]: self._table.Columns.Add(d[0], d[1]) for d in self._COLUMNS } self._loadPanel = Panel() self._loadPanel.Location = Point(0, 0) self._loadPanel.Size = Size(215, 30) self._loadPanel.Dock = DockStyle.Top self._fileTextBoxLabel = Label() self._fileTextBoxLabel.Text = "Load file" self._fileTextBoxLabel.Size = Size(100, 16) self._fileTextBoxLabel.Location = Point(5, 7) self._loadPanel.Controls.Add(self._fileTextBoxLabel) self._fileTextBox = TextBox() self._fileTextBox.Size = Size(200, 20) self._fileTextBox.Location = Point(110, 5) self._loadPanel.Controls.Add(self._fileTextBox) self._loadButton = Button() self._loadButton.Size = Size(50, 20) self._loadButton.Location = Point(315, 5) self._loadButton.Text = "Load" self._loadPanel.Controls.Add(self._loadButton) self._dataPanel = Panel() self._dataPanel.Location = Point(0, 35) self._dataPanel.Size = Size(370, 185) self._dataGrid = DataGridView() self._dataGrid.AllowUserToOrderColumns = True self._dataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize self._dataGrid.Location = Point(0, 0) self._dataGrid.Size = Size(360, 180) self._dataGrid.DataSource = self._table self._dataPanel.Controls.Add(self._dataGrid) self.Controls.Add(self._loadPanel) self.Controls.Add(self._dataPanel) self._loadButton.Click += self.loadData
def initHeaderForListPanel(self): self.headerListPanel = Panel() self.headerListPanel.BackColor = Color.White self.headerListPanel.Width = 360 self.headerListPanel.Height = 30 self.headerListPanel.Location = Point(0, 0) self.lblName = Label() self.lblName.Width = 100.67 self.lblName.Height = 30 self.lblName.Location = Point(0, 0) self.lblName.TextAlign = ContentAlignment.MiddleCenter self.lblName.Text = "Name" self.lblID = Label() self.lblID.Width = 100.67 self.lblID.Height = 30 self.lblID.Location = Point(109, 0) self.lblID.TextAlign = ContentAlignment.MiddleCenter self.lblID.Text = "ID" self.lblNumber = Label() self.lblNumber.Width = 100.67 self.lblNumber.Height = 30 self.lblNumber.Location = Point(218, 0) self.lblNumber.TextAlign = ContentAlignment.MiddleCenter self.lblNumber.Text = "Number" self.headerListPanel.Controls.Add(self.lblName) self.headerListPanel.Controls.Add(self.lblID) self.headerListPanel.Controls.Add(self.lblNumber)
def medPanel(self, x, y): panel = Panel() panel.Width = 300 panel.Height = 300 panel.Location = Point(x, y) panel.BorderStyle = BorderStyle.FixedSingle return panel
def setupPanel2(self): self.panel2 = Panel() self.panel2.Text = "Change_unit Panel" self.panel2.Width = self.Width self.panel2.Height = 50 self.panel2.Location = Point(0, 0) self.panel2.BorderStyle = BorderStyle.FixedSingle self.label3 = Label() self.label3.Text = "设置视图单位:" self.label3.Location = Point(25, 15) self.label3.Height = 15 self.label3.Width = 100 self.textbox3 = TextBox() self.textbox3.Text = "um" self.textbox3.Location = Point(125, 12) self.textbox3.Width = 60 self.button3 = Button() self.button3.Text = 'ok' self.button3.Location = Point(200, 10) self.button3.Width = 40 self.button3.Click += self.c_unit self.panel2.Controls.Add(self.label3) self.panel2.Controls.Add(self.textbox3) self.panel2.Controls.Add(self.button3)
def panel(self, x, y): self.panel = Panel() self.panel.Width = width - 15 self.panel.Height = 800 self.panel.Location = Point(x, y) self.panel.BorderStyle = BorderStyle.Fixed3D self.panel.BackColor = Color.White self.panel.AutoScroll = True j = 30 for i in sorted_list: self.checkbox = CheckBox() self.checkbox.Text = i[0] self.checkbox.Location = Point(35, j) self.checkbox.Font = Font("Calibri Light", 10) self.checkbox_description = Label() self.checkbox_description.Text = i[1] self.checkbox_description.Location = Point(150, j + 2) self.checkbox_description.Width = 500 self.checkbox_description.Font = Font("Calibri Light", 10) self.panel.Controls.Add(self.checkbox) self.panel.Controls.Add(self.checkbox_description) self.check_value.append(self.checkbox) j += 25 return self.panel
def panel(self, x, y): self.panel = Panel() self.panel.Width = width - 15 self.panel.Height = 800 self.panel.Location = Point(x, y) self.panel.BorderStyle = BorderStyle.Fixed3D self.panel.BackColor = Color.White self.panel.AutoScroll = True j = 35 for i in total_point_list: for x in i: self.label = Label() if (len(x)) > 1: if x[1] is not None: self.label.Text = str(x[0]) + " " + str(x[1]) self.label.Location = Point(35, j) self.label.Width = 400 self.label.Font = Font("Calibri Light", 12) self.panel.Controls.Add(self.label) j += 25 return self.panel
def __init__(self, funct, *signature): ''' funct : reference to function (use __doc__ to give details or overide infomain.Text after creation) signature : optional, given with array ['str','str'] title, type ''' self.infunction = funct self.signature = list(signature) self.parameters = [] self.Text = Fconfig.formtitle self.Font = Font(Fconfig.basefont, Fconfig.sizefont) #SystemFonts.DialogFont self.infomain = Label() self.infomain.Parent = self self.infomain.Text = funct.__doc__ self.infomain.Location = Point(Fconfig.margin, Fconfig.margin) self.infomain.Size = Size(Fconfig.smwidth, Fconfig.unitline) self.panel = Panel() self.panel.Parent = self self.panel.Location = Point(0, self.infomain.Bottom) self.panel.AutoSize = True self.panelparams = [] ref = 0 for i, param in enumerate(self.signature): p = Types.types(param[1], 'panel')(param) p.Parent = self.panel p.Location = Point(Fconfig.margin, ref) p.Width = Fconfig.smwidth self.panelparams.append(p) ref += p.Height
def miniPanel(self, x, y): panel = Panel() panel.Width = 750 panel.Height = 150 panel.Location = Point(x, y) panel.BorderStyle = BorderStyle.None return panel
def newPanel(self, x, y): panel = Panel() panel.Width = 5120 panel.Height = 256*(len(self.roi_names)/2.) panel.Location = Point(x, y) panel.BorderStyle = BorderStyle.Fixed3D return panel
def __init__(self): startX = 30 self.Text = "Program2 (Page1)" self.Width = 440 self.Height = 620 self.databaseContainer = Panel() self.databaseContainer.Width = 360 self.databaseContainer.Height = 225 self.databaseContainer.Location = Point(30, 30) self.databaseContainer.BorderStyle = BorderStyle.FixedSingle self.listContainer = Panel() self.listContainer.Width = 360 self.listContainer.Height = 225 self.listContainer.Location = Point(30, 295) self.listContainer.BorderStyle = BorderStyle.FixedSingle self.btnNextPage = Button() self.btnNextPage.Width = 360 self.btnNextPage.Height = 30 self.btnNextPage.Location = Point(30, 530) self.btnNextPage.Text = "Next to Page 2" self.btnNextPage.Enabled = True self.btnNextPage.Click += self.btnNextPage_Clicked self.initHeaderForDatabasePanel() self.initDatabasePanel() self.initHeaderForListPanel() self.initListPanel() for x in range(10): databaseRow = TBL_Generator.DatabaseRow(self, x, "Chatchawan", str(12345 + x)) self.DatabasePanel.Controls.Add(databaseRow) self.databaseContainer.Controls.Add(self.headerDBPanel) self.databaseContainer.Controls.Add(self.DatabasePanel) self.listContainer.Controls.Add(self.ListPanel) self.listContainer.Controls.Add(self.headerListPanel) self.Controls.Add(self.databaseContainer) self.Controls.Add(self.listContainer) self.Controls.Add(self.btnNextPage)
class ShowTextFile(Form): def __init__(self, fName): fContent="" try: with open(fName, 'r') as f: for line in f: fContent += line + "\r\n" #print line f.close() except Exception,e : fContent="No content " self.Text = "SolverStudio pyCMPL Viewer: "+fName self.FormBorderStyle = FormBorderStyle.Sizable # SizableToolWindow # FixedDialog self.Height=500 self.Width = 600 self.Content = TextBox() self.Content.Text=fContent self.Content.ReadOnly=True self.Content.SelectionStart = 0 self.Content.Multiline = True self.Content.WordWrap = False self.Content.ScrollBars = ScrollBars.Both self.Content.Dock = DockStyle.Fill self.Content.Font=Font("Courier New",10) self.bOK=Button() self.bOK.Text = "OK" self.bOK.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right); # self.bOK.Dock = DockStyle.Right # self.bOK.Width = 75 AJM: Go with the default height/width to be more Windows-like # self.bOK.Height = 25 self.bOK.Click += self.OK self.AcceptButton = self.bOK self.buttonPanel=Panel() self.buttonPanel.Dock=DockStyle.Bottom self.buttonPanel.Height=35 self.buttonPanel.Controls.Add(self.bOK) self.bOK.Left = self.buttonPanel.Width - self.bOK.Width - 20 # AJM: Position button nicely self.bOK.Top = 7 # AJM: Position button nicely self.Controls.Add(self.Content) self.Controls.Add(self.buttonPanel) self.CenterToScreen()
def showBox(self): ''' set the remaining box controls and launch ''' self.buttonpanel = Panel() self.buttonpanel.Parent = self self.buttonpanel.Location = Point(0, self.panel.Bottom) self.buttonpanel.Size = Size(Fconfig.smwidth, 2 * Fconfig.unitline) self.buttonpanel.Dock = DockStyle.Bottom self.warning = Label() self.warning.Parent = self.buttonpanel self.warning.Location = Point(Fconfig.margin, 0) self.warning.Size = Size(Fconfig.smwidth, Fconfig.unitline) self.warning.Font = Font(Fconfig.basefont, Fconfig.sizefont, FontStyle.Bold) self.warning.ForeColor = Color.Coral self.warning.TextAlign = ContentAlignment.MiddleCenter okay = Button() okay.Parent = self.buttonpanel okay.Text = Fconfig.buttonOK okay.Location = Point(50, Fconfig.unitline) okay.Width = 140 okay.Click += self.onValidate okay.Anchor = AnchorStyles.Right cancel = Button() cancel.Text = Fconfig.buttonCANCEL cancel.Parent = self.buttonpanel cancel.Location = Point(okay.Right, Fconfig.unitline) cancel.Click += self.onCancel cancel.Anchor = AnchorStyles.Right self.Width = Fconfig.width self.Height = self.panel.Bottom + 105 self.CenterToScreen() ModeDBG.say('\npanel top :{0}, bottom :{1}'.format( self.panel.Top, self.panel.Bottom)) ModeDBG.say('\n\nPanel loaded with {0} items\n'.format( len(self.panelparams))) # Display the form try: if Application.MessageLoop: TaskDialog.Show('UserForm', 'Another window is running...') else: Application.Run(self) except: TaskDialog.Show('UserForm', 'Loading failed...')
def header(self, x, y): style = FontStyle.Bold levels_selected = '-' objects_selected = '-' self.sublabel = Label() self.sublabel.Text = "Number of Levels Selected: " + str( levels_selected) self.sublabel.Location = Point(x + 40, y + 10) self.sublabel.Width = width - 200 self.sublabel.Font = Font("Calibri Light", 12) #self.sublabel.ForeColor = Color.White #self.sublabel.ForeColor = Color.FromArgb(242, 112, 108) #self.sublabel.ForeColor = Color.Black self.sublabel_objects = Label() self.sublabel_objects.Text = "Number of Objects Current Selection: " + str( objects_selected) self.sublabel_objects.Location = Point(x + 40, y + 30) self.sublabel_objects.Width = width - 200 self.sublabel_objects.Font = Font("Calibri Light", 12) #self.sublabel_objects.ForeColor = Color.White self.sublabel_objects.ForeColor = Color.FromArgb(242, 112, 108) self.sublabel_objects.ForeColor = Color.Black self.sublabel_no_selection = Label() self.sublabel_no_selection.Text = "" self.sublabel_no_selection.Location = Point(x + 40, y + 50) self.sublabel_no_selection.Width = width - 200 self.sublabel_no_selection.Font = Font("Calibri Light", 12) #self.sublabel_no_selection.ForeColor = Color.White self.sublabel_no_selection.ForeColor = Color.FromArgb(242, 112, 108) self.sublabel_no_selection.ForeColor = Color.Black self.header = Panel() self.header.Width = width self.header.Height = 80 self.header.AutoSize = True self.header.Font = Font("Calibri", 12) self.header.Location = Point(x, y) self.header.BackColor = Color.FromArgb(145, 201, 213) self.header.Controls.Add(self.sublabel) self.header.Controls.Add(self.sublabel_objects) self.header.Controls.Add(self.sublabel_no_selection) self.header.AutoScroll = True return self.header
def header(self, x, y): style = FontStyle.Bold assembly_codes_selected = '-' objects_selected = '-' self.sublabel = Label() self.sublabel.Text = "ProjectBasePoint (E/W, N/S, Elev)" self.sublabel.Location = Point(x+40, y+10) self.sublabel.Width = width-200 self.sublabel.Font = Font("Calibri Light", 12) self.sublabel.Width = 400 #self.sublabel.ForeColor = Color.White self.sublabel.ForeColor = Color.Black self.sublabel_objects = Label() self.sublabel_objects.Text = "SharedBasePoint (E/W, N/S, Elev)" self.sublabel_objects.Location = Point(x+40, y+30) self.sublabel_objects.Width = width-200 self.sublabel_objects.Font = Font("Calibri Light", 12) self.sublabel_objects.Width = 400 #self.sublabel_objects.ForeColor = Color.White self.sublabel.ForeColor = Color.Black self.sublabel_no_selection = Label() self.sublabel_no_selection.Text = "" self.sublabel_no_selection.Location = Point(x+40, y+50) self.sublabel_no_selection.Width = width-200 self.sublabel_no_selection.Font = Font("Calibri Light", 12, style) #self.sublabel_no_selection.ForeColor = Color.White self.sublabel.ForeColor = Color.Black self.header = Panel() self.header.Width = width self.header.Height = 80 self.header.AutoSize = True self.header.Font = Font("Calibri", 12) self.header.Location = Point(x,y) #self.header.BackColor = Color.FromArgb(0, 0, 0) self.header.BackColor = Color.FromArgb(145, 201, 213) self.header.Controls.Add(self.sublabel) self.header.Controls.Add(self.sublabel_objects) self.header.Controls.Add(self.sublabel_no_selection) self.header.AutoScroll = True return self.header
def setupPanel2(self): self.panel2 = Panel() # self.panel2.Text = "Panel" self.panel2.Width = self.Width self.panel2.Height = 120 self.panel2.Location = Point(0, 120) self.panel2.BorderStyle = BorderStyle.FixedSingle self.p2title1 = Label() self.p2title1.Text = "Create Lumped Port" self.p2title1.Location = Point(25, 22) self.p2title1.Height = 25 self.p2title1.AutoSize = True self.p2label1 = Label() self.p2label1.Text = "Ground Metal Name: " self.p2label1.Location = Point(25, 50) self.p2label1.Height = 25 self.p2label1.Width = 150 self.p2button1 = Button() self.p2button1.Text = 'Create' self.p2button1.Location = Point(25, 75) self.p2button1.Width = 100 self.p2button1.Click += self.p2update self.p2button2 = Button() self.p2button2.Text = 'Reset' self.p2button2.Location = Point(180, 75) self.p2button2.Width = 100 self.p2button2.Click += self.p2reset self.p2list1 = ComboBox() self.p2list1.Text = '——Select' self.p2list1.Location = Point(180, 47) self.p2list1.Width = 100 self.p2list1.Height = 35 self.DropDownHeight = 50 self.p2list1.Click += self.p2listUpdate self.AcceptButton = self.p2button1 self.CancelButton = self.p2button2 self.panel2.Controls.Add(self.p2title1) self.panel2.Controls.Add(self.p2label1) self.panel2.Controls.Add(self.p2button1) self.panel2.Controls.Add(self.p2button2) self.panel2.Controls.Add(self.p2list1)
def setupPanel1(self): self.panel1 = Panel() self.panel1.Width = self.Width self.panel1.Height = 120 self.panel1.Location = Point(0, 0) self.panel1.BorderStyle = BorderStyle.FixedSingle self.title1 = Label() self.title1.Text = "ReAssign Terminal" self.title1.Location = Point(25, 22) self.title1.Height = 25 self.title1.AutoSize = True self.label2 = Label() self.label2.Text = "Ground Metal Name: " self.label2.Location = Point(25, 50) self.label2.Height = 25 self.label2.Width = 150 self.button1 = Button() self.button1.Text = 'Assign' self.button1.Location = Point(25, 75) self.button1.Width = 100 self.button1.Click += self.update self.button2 = Button() self.button2.Text = 'Reset' self.button2.Location = Point(180, 75) self.button2.Width = 100 self.button2.Click += self.reset self.list1 = ComboBox() self.list1.Text = '——Select' self.list1.Location = Point(180, 47) self.list1.Width = 100 self.list1.Height = 35 self.DropDownHeight = 50 self.list1.Click += self.listUpdate self.AcceptButton = self.button1 self.CancelButton = self.button2 self.panel1.Controls.Add(self.label2) self.panel1.Controls.Add(self.title1) self.panel1.Controls.Add(self.button1) self.panel1.Controls.Add(self.button2) self.panel1.Controls.Add(self.list1)
def header(self, x, y): style = FontStyle.Bold assembly_codes_selected = '-' objects_selected = '-' self.sublabel = Label() self.sublabel.Text = "Number of Assembly Codes Selected: " + str(assembly_codes_selected) self.sublabel.Location = Point(x+40, y+10) self.sublabel.Width = width-200 self.sublabel.Font = Font("Calibri Light", 12) self.sublabel.ForeColor = Color.White self.sublabel_objects = Label() self.sublabel_objects.Text = "Number of Objects Current Selection: " + str(objects_selected) self.sublabel_objects.Location = Point(x+40, y+30) self.sublabel_objects.Width = width-200 self.sublabel_objects.Font = Font("Calibri Light", 12) self.sublabel_objects.ForeColor = Color.White self.sublabel_no_selection = Label() self.sublabel_no_selection.Text = "" self.sublabel_no_selection.Location = Point(x+40, y+50) self.sublabel_no_selection.Width = width-200 self.sublabel_no_selection.Font = Font("Calibri Light", 12, style) self.sublabel_no_selection.ForeColor = Color.White self.header = Panel() self.header.Width = width self.header.Height = 80 self.header.AutoSize = True self.header.Font = Font("Calibri", 12) self.header.Location = Point(x,y) self.header.BackColor = Color.FromArgb(0, 0, 0) self.header.Controls.Add(self.sublabel) self.header.Controls.Add(self.sublabel_objects) self.header.Controls.Add(self.sublabel_no_selection) self.header.AutoScroll = True return self.header
def initHeaderForStatusPanel(self): self.headerStatusPanel = Panel() self.headerStatusPanel.BackColor = Color.White self.headerStatusPanel.Width = 310 self.headerStatusPanel.Height = 20 self.headerStatusPanel.Location = Point(0, 0) self.lblName = Label() self.lblName.Width = 70 self.lblName.Height = 20 self.lblName.Location = Point(6, 0) self.lblName.TextAlign = ContentAlignment.MiddleCenter self.lblName.Text = "Name" self.lblID = Label() self.lblID.Width = 70 self.lblID.Height = 20 self.lblID.Location = Point(82, 0) self.lblID.TextAlign = ContentAlignment.MiddleCenter self.lblID.Text = "ID" self.lblNumber = Label() self.lblNumber.Width = 70 self.lblNumber.Height = 20 self.lblNumber.Location = Point(158, 0) self.lblNumber.TextAlign = ContentAlignment.MiddleCenter self.lblNumber.Text = "Number" self.lblStatus = Label() self.lblStatus.Width = 70 self.lblStatus.Height = 20 self.lblStatus.Location = Point(225, 0) self.lblStatus.TextAlign = ContentAlignment.MiddleCenter self.lblStatus.Text = "Status" self.headerStatusPanel.Controls.Add(self.lblName) self.headerStatusPanel.Controls.Add(self.lblID) self.headerStatusPanel.Controls.Add(self.lblNumber) self.headerStatusPanel.Controls.Add(self.lblStatus)
def footer(self, x, y): button_width = (500/3)-6 self.button_filter_selection = Button() self.button_filter_selection.Text = 'Filter Selection' self.button_filter_selection.Location = Point(2*(button_width),0) self.button_filter_selection.Click += self.update self.button_filter_selection.Width = button_width self.button_filter_selection.Height = 50 self.button_clear_selection = Button() self.button_clear_selection.Text = 'Clear Selection' self.button_clear_selection.Location = Point(0,0) self.button_clear_selection.Width = button_width self.button_clear_selection.Height = 50 self.button_clear_selection.Font = Font("Calibri Light",12) self.button_clear_selection.Click += self.uncheck_checkboxes self.button_objects_without_code = Button() self.button_objects_without_code.Text = 'Objects Without Assembly Code' self.button_objects_without_code.Location = Point(button_width,0) self.button_objects_without_code.Width = button_width self.button_objects_without_code.Height = 50 self.button_objects_without_code.Click += self.check_pushbutton_empty_assembly_code self.footer = Panel() self.footer.Width = width-15 self.footer.Height = 50 self.footer.Font = Font("Calibri", 12) self.footer.Location = Point(x,y-50) #self.footer.BackColor = Color.FromArgb(232, 52, 38) self.footer.Controls.Add(self.button_filter_selection) self.footer.Controls.Add(self.button_clear_selection) self.footer.Controls.Add(self.button_objects_without_code) return self.footer
def panel(self, x, y): self.panel = Panel() self.panel.Width = width - 15 self.panel.Height = 800 self.panel.Location = Point(x, y) self.panel.BorderStyle = BorderStyle.Fixed3D self.panel.BackColor = Color.White self.panel.AutoScroll = True j = 30 for x in sorted_material_list: self.checkbox = Label() self.checkbox.Text = str(x.Name) self.checkbox.Location = Point(35, j) j += 25 self.checkbox.Width = width - 95 self.checkbox.Font = Font("Calibri Light", 10) self.panel.Controls.Add(self.checkbox) return self.panel
def panel(self, x, y): self.panel = Panel() self.panel.Width = width - 15 self.panel.Height = 800 self.panel.Location = Point(x, y) self.panel.BorderStyle = BorderStyle.Fixed3D self.panel.BackColor = Color.White self.panel.AutoScroll = True j = 30 for i in range(0, len(sorted_level_list)): self.checkbox = CheckBox() self.checkbox.Text = str(sorted_level_list[i]) self.checkbox.Location = Point(35, j) j += 25 self.checkbox.Width = width - 95 self.checkbox.Font = Font("Calibri Light", 10) self.panel.Controls.Add(self.checkbox) self.check_value.append(self.checkbox) return self.panel
def initHeaderForDatabasePanel(self): self.headerDBPanel = Panel() self.headerDBPanel.BackColor = Color.White self.headerDBPanel.Width = 360 self.headerDBPanel.Height = 30 self.headerDBPanel.Location = Point(0, 0) self.lblName = Label() self.lblName.Width = 133 self.lblName.Height = 30 self.lblName.Location = Point(49, 0) self.lblName.TextAlign = ContentAlignment.MiddleCenter self.lblName.Text = "Name" self.lblID = Label() self.lblID.Width = 133 self.lblID.Height = 30 self.lblID.Location = Point(188, 0) self.lblID.TextAlign = ContentAlignment.MiddleCenter self.lblID.Text = "ID" self.headerDBPanel.Controls.Add(self.lblName) self.headerDBPanel.Controls.Add(self.lblID)
def setupPanel1(self): #介质层BOX Panel self.panel1 = Panel() self.panel1.Text = "Media_Box Panel" self.panel1.Width = self.Width self.panel1.Height = 120 self.panel1.Location = Point(0, 50) self.panel1.BorderStyle = BorderStyle.FixedSingle self.label1 = Label() self.label1.Text = "介质层宽度(X轴):" self.label1.Location = Point(25, 25) self.label1.Height = 25 self.label1.Width = 150 self.label2 = Label() self.label2.Text = "介质层长度(Y轴):" self.label2.Location = Point(25, 50) self.label2.Height = 25 self.label2.Width = 150 self.textbox1 = TextBox() self.textbox1.Text = "0" self.textbox1.Location = Point(200, 22) self.textbox1.Width = 80 self.textbox2 = TextBox() self.textbox2.Text = "0" self.textbox2.Location = Point(200, 47) self.textbox2.Width = 80 self.button1 = Button() self.button1.Text = 'Create' self.button1.Location = Point(25, 75) self.button1.Width = 100 self.button1.Click += self.update self.button2 = Button() self.button2.Text = 'Reset' self.button2.Location = Point(180, 75) self.button2.Width = 100 self.button2.Click += self.reset self.AcceptButton = self.button1 self.CancelButton = self.button2 self.radio1 = RadioButton() self.radio1.Text = "mm" self.radio1.Location = Point(300, 50) self.radio1.Width = 35 self.radio1.CheckedChanged += self.checkedChanged self.radio2 = RadioButton() self.radio2.Text = "um" self.radio2.Location = Point(300, 25) self.radio2.Width = 35 self.radio2.Checked = True self.radio2.CheckedChanged += self.checkedChanged self.panel1.Controls.Add(self.label1) self.panel1.Controls.Add(self.label2) self.panel1.Controls.Add(self.textbox1) self.panel1.Controls.Add(self.textbox2) self.panel1.Controls.Add(self.button1) self.panel1.Controls.Add(self.button2) self.panel1.Controls.Add(self.radio1) self.panel1.Controls.Add(self.radio2)
from FileInterface import FileInterface LOGGER = create_logger('Viewport') FORMBOXES = {} FI = None LOGGER.info("Booting viewport.") window = Form() window.Text = "tagme" window.Name = "tagme" window.Size = Size(500, 300) window.FormBorderStyle = FormBorderStyle.FixedDialog # TOP LEVEL CONTROLS ################### LOAD_AREA = Panel() #LOAD_AREA.BorderStyle = BorderStyle.FixedSingle LOAD_AREA.Width = window.ClientRectangle.Width LOAD_AREA.Height = 20 LOAD_AREA.Dock = DockStyle.Top window.Controls.Add(LOAD_AREA) MUTATION_AREA = Panel() MUTATION_AREA.Width = LOAD_AREA.Width MUTATION_AREA.Height = LOAD_AREA.Height #MUTATION_AREA.BorderStyle = BorderStyle.FixedSingle MUTATION_AREA.Dock = DockStyle.Fill #MUTATION_AREA.BackColor = Color.Red window.Controls.Add(MUTATION_AREA) #########################################
def setupPanel3(self): self.panel3 = Panel() self.panel3.Width = self.Width self.panel3.Height = 125 self.panel3.Location = Point(0, 170) self.panel3.BorderStyle = BorderStyle.FixedSingle self.checkLabel1 = Label() self.checkLabel1.Text = "选择以下金属层材料进行创建:" self.checkLabel1.Location = Point(25, 25) self.checkLabel1.AutoSize = True self.P3button1 = Button() self.P3button1.Text = 'ok' self.P3button1.Location = Point(200, 20) self.P3button1.Width = 40 self.P3button1.Click += self.P3_update1 self.check1 = CheckBox() self.check1.Text = "M1" self.check1.Location = Point(25, 50) self.check1.Width = 90 self.check2 = CheckBox() self.check2.Text = "M2-8" self.check2.Location = Point(115, 50) self.check2.Width = 90 self.check3 = CheckBox() self.check3.Text = "M9" self.check3.Location = Point(205, 50) self.check3.Width = 90 self.check4 = CheckBox() self.check4.Text = "M10(UTM)" self.check4.Location = Point(295, 50) self.check4.Width = 90 self.check5 = CheckBox() self.check5.Text = "Via1-7" self.check5.Location = Point(25, 75) self.check5.Width = 90 self.check6 = CheckBox() self.check6.Text = "Via8" self.check6.Location = Point(115, 75) self.check6.Width = 90 self.check7 = CheckBox() self.check7.Text = "Via9" self.check7.Location = Point(205, 75) self.check7.Width = 90 self.check8 = CheckBox() self.check8.Text = "全选" self.check8.Location = Point(295, 75) self.check8.Width = 90 self.check8.CheckedChanged += self.P3C8_update self.panel3.Controls.Add(self.checkLabel1) self.panel3.Controls.Add(self.P3button1) self.panel3.Controls.Add(self.check1) self.panel3.Controls.Add(self.check2) self.panel3.Controls.Add(self.check3) self.panel3.Controls.Add(self.check4) self.panel3.Controls.Add(self.check5) self.panel3.Controls.Add(self.check6) self.panel3.Controls.Add(self.check7) self.panel3.Controls.Add(self.check8)
def header(self, x, y): style = FontStyle.Bold fire_rating_selected = '-' objects_selected = '-' self.sublabel = Label() self.sublabel.Text = "Number of Fire Rating Selected: " + str( fire_rating_selected) self.sublabel.Location = Point(x + 40, y + 10) self.sublabel.Width = width - 200 self.sublabel.Font = Font("Calibri Light", 12) #self.sublabel.ForeColor = Color.White self.sublabel.ForeColor = Color.Black self.sublabel_objects = Label() self.sublabel_objects.Text = "Number of Objects Current Selection: " + str( objects_selected) self.sublabel_objects.Location = Point(x + 40, y + 30) self.sublabel_objects.Width = width - 200 self.sublabel_objects.Height = 20 self.sublabel_objects.Font = Font("Calibri Light", 12) #self.sublabel_objects.ForeColor = Color.White self.sublabel.ForeColor = Color.Black self.sublabel_no_selection = Label() self.sublabel_no_selection.Text = "Parameters shown below include type and instance" self.sublabel_no_selection.Location = Point(x + 40, y + 63) self.sublabel_no_selection.Width = width - 200 self.sublabel_no_selection.Font = Font("Calibri Light", 8) #self.sublabel_no_selection.ForeColor = Color.White self.sublabel.Height = 20 self.sublabel.ForeColor = Color.Black self.warning_label = Label() self.warning_label.Text = "Please be aware there is a distinction between the standard Revit Fire Rating parameter" self.warning_label.Font = Font("Calibri", 8) self.warning_label.Width = width self.warning_label.Height = 12 self.warning_label.Location = Point(x + 40, y + 40) self.warning_label.ForeColor = Color.Black self.warning_sublabel = Label() self.warning_sublabel.Text = "(with space) and the BuildingSmart definition FireRating parameter (without space)" self.warning_sublabel.Font = Font("Calibri", 8) self.warning_sublabel.Width = width self.warning_sublabel.Location = Point(x + 40, y + 50) self.header = Panel() self.header.Width = width self.header.Height = 80 self.header.AutoSize = True self.header.Font = Font("Calibri", 12) self.header.Location = Point(x, y) #self.header.BackColor = Color.FromArgb(0, 0, 0) self.header.BackColor = Color.FromArgb(145, 201, 213) self.header.Controls.Add(self.sublabel) #self.header.Controls.Add(self.sublabel_objects) self.header.Controls.Add(self.sublabel_no_selection) self.header.Controls.Add(self.warning_label) self.header.Controls.Add(self.warning_sublabel) #self.header.Controls.Add(self.warning_parameters) self.header.AutoScroll = True return self.header
def __init__(self): #the __init__ method inside a class is its constructor self.Text = "AU London" #text that appears in the GUI titlebar self.Icon = Icon.FromHandle( icon.GetHicon() ) #takes a bitmap image and converts to a file that can be used as a Icon for the titlebar self.BackColor = Color.FromArgb(255, 255, 255) self.WindowState = FormWindowState.Normal # set maximised minimised or normal size GUI self.CenterToScreen() # centres GUI to the middle of your screen self.BringToFront() #brings the GUI to the front of all opens windows. self.Topmost = True # true to display the GUI infront of any other active forms screenSize = Screen.GetWorkingArea( self ) #get the size of the computers main screen, as the form will scale differently to different sized screens self.Width = screenSize.Width / 4 #set the size of the form based on the size of the users screen. this helps to ensure consistant look across different res screens. self.Height = screenSize.Height / 4 uiWidth = self.DisplayRectangle.Width #get the size of the form to use to scale form elements uiHeight = self.DisplayRectangle.Height self.FormBorderStyle = FormBorderStyle.FixedDialog # fixed dialog stops the user from adjusting the form size. Recomended disabling this when testing to see if elements are in the wrong place. self.userOutput = userOutputDefaultStr #create a container to store the output from the form self.runNextOutput = False #set these default values #############-------------\-------------############# spacing = 10 #spacing size for GUI elements to form a consistent border # creates the text box for a info message userMessage = Label() #label displays texts font = Font("Helvetica ", 10) userMessage.Text = message userMessage.Font = font userMessage.Location = Point( spacing, spacing ) #all location require a point object from system.Drawing to set the location. userMessage.Size = Size( uiWidth - (spacing * 2), (uiHeight / 4) ) #size the control with the width of the GUI to ensure it scales with different screen self.Controls.Add(userMessage) #this adds control element to the GUI #############-------------\-------------############# #logo file logo = PictureBox() logo.Image = logoFile ratio = float(logo.Height) / float( logo.Width ) #needs to be a float as int will round to the nearest whole number logo.Size = Size( uiWidth / 4, (uiHeight / 4) * ratio ) #scale the image by the ratio between the images height & width logo.Location = Point(spacing, (uiHeight - logo.Height) - spacing) logo.SizeMode = PictureBoxSizeMode.Zoom # zooms the image to fit the extent logo.Anchor = ( AnchorStyles.Bottom | AnchorStyles.Left ) #anchor styles lock elements to a given corner of the GUI if you allow users change size self.Controls.Add(logo) #logo.BorderStyle = BorderStyle.Fixed3D #gives a border to the panel to test its location #############-------------\-------------############# #combox drop down cBox = ComboBox() #dropdown control form cBox.Location = Point(spacing, uiHeight / 3) cBox.Width = uiWidth - (spacing * 2) cBox.Items.AddRange( listInput ) # Adds an array of items to the list of items for a ComboBox. cBox.DropDownStyle = ComboBoxStyle.DropDownList #setting to dropdown list prevents users from being able to add aditional text values cBox.SelectedIndexChanged += self.dropDownOutput #.Click+= registers the press of the button to register the event handler and determine what action takes place when button clicked self.Controls.Add(cBox) #############-------------\-------------############# #Create ok button btnOk = Button() #create a button control btnOk.Text = "Next" btnOk.Location = Point(uiWidth - ((btnOk.Width * 2) + spacing), uiHeight - (btnOk.Height + spacing)) btnOk.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right) btnOk.Click += self.okButtonPressed #Register the event on the button bress to trigger the def okButtonPressed self.Controls.Add(btnOk) #Create Cancel Button btnCancel = Button() #btnCancel.Parent = self btnCancel.Text = "Cancel" btnCancel.Location = Point(uiWidth - (btnOk.Width + spacing), uiHeight - (btnOk.Height + spacing)) btnCancel.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right) btnCancel.Click += self.CnlButtonPressed self.Controls.Add(btnCancel) #############-------------\-------------############# #Create a weblink helplink = LinkLabel() helplink.Text = "User Guide" helplink.Tag = linkaddress #tag is the web address helplink.Click += self.openLink #register click event with event handler helplink.Location = Point(uiWidth - ((btnOk.Width * 3) + spacing), uiHeight - (btnOk.Height + 5)) self.Controls.Add(helplink) helplink.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left) colourPanel = Panel() colourPanel.Height = cBox.Height + spacing #locate the panel behind the combo box. colourPanel.Width = uiWidth colourPanel.Location = Point(0, (uiHeight / 3) - 5) colourPanel.BorderStyle = BorderStyle.Fixed3D # graphical style to pronounce the edge of the panel colourPanel.BackColor = Color.FromArgb( 1, 125, 199) #set background colour by RGB value self.Controls.Add(colourPanel)