def __init__(self): self.fm = doc.FamilyManager self._all_param_names = None self.Text = 'Параметры' self.Name = 'Select Parameters' self.Width = 400 self.Height = 450 self.title = Label() self.title.Text = "Выберете параметры" self.title.Height = 30 self.title.TextAlign = ContentAlignment.MiddleCenter self.title.Dock = DockStyle.Top self.label = Label() self.label.Text = "Выберете новую группу параметров" self.label.Height = 30 self.label.TextAlign = ContentAlignment.MiddleCenter self.label.Dock = DockStyle.Top self.listbox = ListBox() self.listbox.MultiColumn = False self.listbox.SelectionMode = SelectionMode.MultiExtended self.listbox.BeginUpdate() params = list(self.all_param_names.keys()) params.sort() for i in params: self.listbox.Items.Add(i) self.listbox.EndUpdate() self.listbox.Height = 270 self.listbox.Location = Point(0, 30) self.listbox.Dock = DockStyle.Top self.combobox = ComboBox() els = list(self.all_param_group.keys()) els.sort() for i in els: self.combobox.Items.Add(i) self.combobox.Location = Point(0, 300) self.combobox.Dock = DockStyle.Top self.button = Button() self.button.Text = "Перенести" self.button.Dock = DockStyle.Top self.button.Click += self.change_param_group self.Controls.Add(self.button) self.Controls.Add(self.combobox) self.Controls.Add(self.label) self.Controls.Add(self.listbox) self.Controls.Add(self.title) self.handler = Execute_change_group() self.exEvent = ExternalEvent.Create(self.handler)
def _initializeUserInterface(self): self.Size = Size(1600, 500) self.tlpMain.ColumnCount = len(self.columnNames) self.tlpMain.RowCount = 2 self.tlpMain.Size = self.ClientRectangle.Size #create list titles for name in self.columnNames: lbl = Label() lbl.Text = name lbl.Font = Font("Microsoft Sans Serif", 12, FontStyle.Bold) lbl.Height = 50 self.tlpMain.Controls.Add(lbl) #create lists for name in self.columnNames: lst = ListBox() lst.Name = name lst.Font = Font("Microsoft Sans Serif", 10) lst.Width = 135 if name.ToLower() == 'attribute': lst.Width = 300 if name.ToLower() == 'mode': lst.Width = 215 lst.Height = self.ClientRectangle.Height - (lbl.Height * 2) self.tlpMain.Controls.Add(lst) self._populateLists(lst)
def __init__(self): self.Text = "ListBox" lb = ListBox() lb.Parent = self lb.Items.Add("Jessica") lb.Items.Add("Rachel") lb.Items.Add("Angelina") lb.Items.Add("Amy") lb.Items.Add("Jennifer") lb.Items.Add("Scarlett") lb.Dock = DockStyle.Fill lb.SelectedIndexChanged += self.OnChanged self.sb = StatusBar() self.sb.Parent = self self.Size = Size(220, 220) self.CenterToScreen()
def __init__(self): """ListBoxSample class init function.""" # setup title self.Text = "ScrollBar control" # setup label self.label1 = Label() self.label1.Text = "listbox with vertical scrollbar" self.label1.AutoSize = True self.label1.Location = Point(10, 10) # setup listbox1 self.listbox1 = ListBox() self.listbox1.Width = 260 self.listbox1.Location = Point(10, 40) self.label2 = Label() self.label2.Text = "listbox with horizontal scrollbar" self.label2.AutoSize = True self.label2.Location = Point(10, 150) # setup listbox2 self.listbox2 = ListBox() self.listbox2.Width = 260 self.listbox2.MultiColumn = True self.listbox2.Location = Point(10, 180) # add items in ListBox for i in range(30): self.listbox1.Items.Add(str(i)) self.listbox2.Items.Add(str(i)) # add controls self.Controls.Add(self.label1) self.Controls.Add(self.listbox1) self.Controls.Add(self.label2) self.Controls.Add(self.listbox2)
def __init__(self, moduleManager, contents): ListBox.__init__(self) self.moduleManager = moduleManager # behaviour self.LabelEdit = False self.MultiSelect = False # appearance self.Dock = DockStyle.Fill self.ScrollAlwaysVisible = True self.TabIndex = 0 self.HideSelection = False # Keep selected item grey when lost focus self.textBrush = SolidBrush(SystemColors.WindowText) self.icon = Bitmap(UIGlobal.ModuleIcon) self.DrawMode = DrawMode.OwnerDrawVariable self.DrawItem += self.OnDrawItem self.MeasureItem += self.OnMeasureItem self.UpdateAllItems(contents)
def __init__(self): self.fm = doc.FamilyManager self._all_param_names = None self.Text = 'Параметры' self.Name = 'Select Parameters' self.Width = 210 self.Height = 400 self.title = Label() self.title.Text = "Выберете параметры" self.title.Height = 30 self.title.TextAlign = ContentAlignment.MiddleCenter self.title.Dock = DockStyle.Top self.combobox = ListBox() self.combobox.MultiColumn = False self.combobox.SelectionMode = SelectionMode.MultiExtended self.combobox.BeginUpdate() for i in self.all_param_names: self.combobox.Items.Add(i) self.combobox.EndUpdate() self.combobox.Height = 270 self.combobox.Location = Point(0, 30) self.combobox.Dock = DockStyle.Top self.button = Button() self.button.Text = "Выполнить" self.button.Dock = DockStyle.Top self.button.Click += self.change_param_type self.Controls.Add(self.button) self.Controls.Add(self.combobox) self.Controls.Add(self.title) self.handler = Execute_change_type() self.exEvent = ExternalEvent.Create(self.handler)
def __init__(self): """PageSetupDialogSample class init function.""" # setup title self.Text = "PageSetupDialog control" # setup button self.button = Button() self.button.Text = "Click me" self.button.Location = Point(10, 210) self.button.Click += self.page_setup_dialog # setup listbox self.listbox = ListBox() self.listbox.Size = Size(self.Width - 10, 200) self.listbox.BorderStyle = BorderStyle.FixedSingle # add controls self.Controls.Add(self.listbox) self.Controls.Add(self.button)
def InitializeComponent(self): self.Label = Label() self.Items = ListBox() self.Selection = ListBox() self.Okay = Button() self.Up = Button() self.Down = Button() self.UseRegardless = CheckBox() self.UseAsFolder = CheckBox() self.AlwaysUseDontAsk = CheckBox() self.Add = Button() self.Remove = Button() self.SLabel = Label() self.ILabel = Label() # # Label # self.Label.Location = Point(12, 8) self.Label.Size = Size(430, 30) # # Items Label # self.ILabel.Location = Point(12, 38) self.ILabel.TextAlign = ContentAlignment.MiddleCenter self.ILabel.Size = Size(159, 14) # # Items # self.Items.Location = Point(12, 55) self.Items.Name = "Items" self.Items.Size = Size(159, 134) self.Items.TabIndex = 0 self.Items.Sorted = True self.Items.DoubleClick += self.AddItem # # Selection Label # self.SLabel.Location = Point(211, 38) self.SLabel.TextAlign = ContentAlignment.MiddleCenter self.SLabel.Size = Size(159, 14) # # Selection # self.Selection.Location = Point(211, 55) self.Selection.Name = "Selection" self.Selection.Size = Size(159, 134) self.Selection.TabIndex = 3 self.Selection.DoubleClick += self.RemoveItem # # Up # self.Up.Location = Point(378, 70) self.Up.Name = "Up" self.Up.Size = Size(47, 23) self.Up.TabIndex = 4 self.Up.Text = "Up" self.Up.UseVisualStyleBackColor = True self.Up.Click += self.MoveUp # # Down # self.Down.Location = Point(378, 130) self.Down.Name = "Down" self.Down.Size = Size(47, 23) self.Down.TabIndex = 5 self.Down.Text = "Down" self.Down.UseVisualStyleBackColor = True self.Down.Click += self.MoveDown # # UseRegardless # self.UseRegardless.Location = Point(12, 190) self.UseRegardless.Name = "UseRegardless" self.UseRegardless.Size = Size(421, 34) self.UseRegardless.TabIndex = 7 self.UseRegardless.UseVisualStyleBackColor = True self.UseRegardless.Enabled = True # # Always use # self.AlwaysUse = CheckBox() self.AlwaysUse.Location = Point(12, 190) self.AlwaysUse.Size = Size(413, 35) self.AlwaysUse.CheckedChanged += self.AlwaysUseCheckChanged # # Always use don't ask # self.AlwaysUseDontAsk.Location = Point(30, 230) self.AlwaysUseDontAsk.AutoSize = True self.AlwaysUseDontAsk.Checked = True self.AlwaysUseDontAsk.Enabled = False # # UseAsFolder # self.UseAsFolder.Location = Point(12, 260) self.UseAsFolder.Name = "UseAsFolder" self.UseAsFolder.Size = Size(252, 24) self.UseAsFolder.TabIndex = 8 self.UseAsFolder.Text = "Seperate each item with a folder" self.UseAsFolder.UseVisualStyleBackColor = True # # Okay # self.Okay.Location = Point(267, 260) self.Okay.Name = "Okay" self.Okay.Size = Size(75, 23) self.Okay.TabIndex = 9 self.Okay.Text = "Okay" self.Okay.UseVisualStyleBackColor = True self.Okay.DialogResult = DialogResult.OK # # Cancel # self.Cancel = Button() self.Cancel.Location = Point(350, 260) self.Cancel.Size = Size(75, 23) self.Cancel.Text = "Cancel" self.Cancel.DialogResult = DialogResult.Cancel # # Add # self.Add.Location = Point(179, 70) self.Add.Name = "Add" self.Add.Size = Size(24, 23) self.Add.TabIndex = 1 self.Add.Text = "->" self.Add.UseVisualStyleBackColor = True self.Add.Click += self.AddItem # # Remove # self.Remove.Location = Point(179, 130) self.Remove.Name = "Remove" self.Remove.Size = Size(24, 23) self.Remove.TabIndex = 2 self.Remove.Text = "<-" self.Remove.UseVisualStyleBackColor = True self.Remove.Click += self.RemoveItem # # SelectionForm # self.ClientSize = Size(437, 290) self.Controls.Add(self.Label) self.Controls.Add(self.UseAsFolder) self.Controls.Add(self.UseRegardless) self.Controls.Add(self.Remove) self.Controls.Add(self.Add) self.Controls.Add(self.Down) self.Controls.Add(self.Up) self.Controls.Add(self.Okay) self.Controls.Add(self.Selection) self.Controls.Add(self.AlwaysUse) self.Controls.Add(self.AlwaysUseDontAsk) self.Controls.Add(self.Cancel) self.Controls.Add(self.Items) self.Controls.Add(self.SLabel) self.Controls.Add(self.ILabel) self.FormBorderStyle = FormBorderStyle.FixedDialog self.ShowIcon = True self.AcceptButton = self.Okay self.MaximizeBox = False self.MinimizeBox = False self.Icon = System.Drawing.Icon(ICON) self.StartPosition = FormStartPosition.CenterParent
def InitializeComponent(self): self.settings = { "RuneBookBanca": None, "RuneBookMining": list(), "MineBag": None, "MineBag2": None, "PosizioneRunaCasa": None, "FireBeetle": None, "Posizione": None } self._label_posizioneRuna = Label() self._groupBox_minebook = GroupBox() self._button_delListaRunebook = Button() self._listBox_Runebook = ListBox() self._button_addListaRunebook = Button() self._groupBox_runebookCasa = GroupBox() self._button_runeBookCasa = Button() self._numericUpDown1 = NumericUpDown() self._label_runebookCasa = Label() self._groupBox_casa = GroupBox() self._button_position = Button() self._button_lingotti = Button() self._button_gemme = Button() self._label_position = Label() self._label_lingotti = Label() self._label_gemme = Label() self._groupBox_pet = GroupBox() self._button_fireBeetle = Button() self._label_fireBeetle = Label() self._groupBox_output = GroupBox() self._textBox_output = TextBox() self._button_Run = Button() self._groupBox_extra = GroupBox() self._button_daiCibo = Button() self._button_scarico = Button() self._button_smelta = Button() # # label_posizioneRuna # self._label_posizioneRuna.Location = Point(6, 13) self._label_posizioneRuna.Name = "label_posizioneRuna" self._label_posizioneRuna.Size = Size(127, 23) self._label_posizioneRuna.TabIndex = 0 self._label_posizioneRuna.Text = "Posizione runa:" self._label_posizioneRuna.TextAlign = ContentAlignment.MiddleRight # # groupBox_minebook # self._groupBox_minebook.Controls.Add(self._button_delListaRunebook) self._groupBox_minebook.Controls.Add(self._listBox_Runebook) self._groupBox_minebook.Controls.Add(self._button_addListaRunebook) self._groupBox_minebook.Location = Point(12, 12) self._groupBox_minebook.Name = "groupBox_minebook" self._groupBox_minebook.Size = Size(208, 127) self._groupBox_minebook.TabIndex = 6 self._groupBox_minebook.TabStop = False self._groupBox_minebook.Text = "Runebook" # # button_delListaRunebook # self._button_delListaRunebook.AccessibleName = "" self._button_delListaRunebook.Location = Point(139, 91) self._button_delListaRunebook.Name = "button_delListaRunebook" self._button_delListaRunebook.Size = Size(63, 25) self._button_delListaRunebook.TabIndex = 2 self._button_delListaRunebook.Text = "Cancella" self._button_delListaRunebook.UseVisualStyleBackColor = True self._button_delListaRunebook.Click += self.Button_delListaRunebookClick # # listBox_Runebook # self._listBox_Runebook.FormattingEnabled = True self._listBox_Runebook.ImeMode = ImeMode.Hangul self._listBox_Runebook.Location = Point(6, 19) self._listBox_Runebook.Name = "listBox_Runebook" self._listBox_Runebook.Size = Size(127, 95) self._listBox_Runebook.TabIndex = 0 # # button_addListaRunebook # self._button_addListaRunebook.AccessibleName = "" self._button_addListaRunebook.Location = Point(139, 62) self._button_addListaRunebook.Name = "button_addListaRunebook" self._button_addListaRunebook.Size = Size(63, 25) self._button_addListaRunebook.TabIndex = 1 self._button_addListaRunebook.Text = "Aggiungi" self._button_addListaRunebook.UseVisualStyleBackColor = True self._button_addListaRunebook.Click += self.Button_addListaRunebookClick # # groupBox_runebookCasa # self._groupBox_runebookCasa.Controls.Add(self._label_runebookCasa) self._groupBox_runebookCasa.Controls.Add(self._button_runeBookCasa) self._groupBox_runebookCasa.Controls.Add(self._label_posizioneRuna) self._groupBox_runebookCasa.Controls.Add(self._numericUpDown1) self._groupBox_runebookCasa.Location = Point(12, 145) self._groupBox_runebookCasa.Name = "groupBox_runebookCasa" self._groupBox_runebookCasa.Size = Size(208, 77) self._groupBox_runebookCasa.TabIndex = 22 self._groupBox_runebookCasa.TabStop = False self._groupBox_runebookCasa.Text = "Runebook Casa" # # button_runeBookCasa # self._button_runeBookCasa.AccessibleName = "" self._button_runeBookCasa.Location = Point(139, 40) self._button_runeBookCasa.Name = "button_runeBookCasa" self._button_runeBookCasa.Size = Size(63, 25) self._button_runeBookCasa.TabIndex = 22 self._button_runeBookCasa.Text = "Imposta" self._button_runeBookCasa.UseVisualStyleBackColor = True self._button_runeBookCasa.Click += self.Button_runeBookCasaClick # # numericUpDown1 # self._numericUpDown1.Location = Point(139, 16) self._numericUpDown1.Name = "domainUpDown1" self._numericUpDown1.Size = Size(37, 20) self._numericUpDown1.TabIndex = 3 self._numericUpDown1.Maximum = 12 self._numericUpDown1.Minimum = 1 # # label_runebookCasa # self._label_runebookCasa.Location = Point(6, 42) self._label_runebookCasa.Margin = Padding(0) self._label_runebookCasa.Name = "label_runebookCasa" self._label_runebookCasa.Size = Size(127, 23) self._label_runebookCasa.TabIndex = 23 self._label_runebookCasa.Text = "Runebook Casa:" self._label_runebookCasa.TextAlign = ContentAlignment.MiddleRight # # groupBox_casa # self._groupBox_casa.Controls.Add(self._label_gemme) self._groupBox_casa.Controls.Add(self._label_lingotti) self._groupBox_casa.Controls.Add(self._label_position) self._groupBox_casa.Controls.Add(self._button_position) self._groupBox_casa.Controls.Add(self._button_lingotti) self._groupBox_casa.Controls.Add(self._button_gemme) self._groupBox_casa.Location = Point(12, 230) self._groupBox_casa.Name = "groupBox_casa" self._groupBox_casa.Size = Size(208, 116) self._groupBox_casa.TabIndex = 23 self._groupBox_casa.TabStop = False self._groupBox_casa.Text = "Casa" # # button_position # self._button_position.AccessibleName = "" self._button_position.Location = Point(139, 14) self._button_position.Name = "button_position" self._button_position.Size = Size(63, 25) self._button_position.TabIndex = 3 self._button_position.Text = "Set" self._button_position.UseVisualStyleBackColor = True self._button_position.Click += self.Button_positionClick # # button_lingotti # self._button_lingotti.AccessibleName = "" self._button_lingotti.Location = Point(139, 45) self._button_lingotti.Name = "button_lingotti" self._button_lingotti.Size = Size(63, 25) self._button_lingotti.TabIndex = 7 self._button_lingotti.Text = "Imposta" self._button_lingotti.UseVisualStyleBackColor = True self._button_lingotti.Click += self.Button_lingottiClick # # button_gemme # self._button_gemme.AccessibleName = "" self._button_gemme.Location = Point(139, 76) self._button_gemme.Name = "button_gemme" self._button_gemme.Size = Size(63, 25) self._button_gemme.TabIndex = 9 self._button_gemme.Text = "Imposta" self._button_gemme.UseVisualStyleBackColor = True self._button_gemme.Click += self.Button_gemmeClick # # label_position # self._label_position.Location = Point(6, 14) self._label_position.Name = "label_position" self._label_position.Size = Size(127, 23) self._label_position.TabIndex = 24 self._label_position.Text = "Posizione di scarico" self._label_position.TextAlign = ContentAlignment.MiddleRight # # label_lingotti # self._label_lingotti.Location = Point(6, 47) self._label_lingotti.Name = "label_lingotti" self._label_lingotti.Size = Size(127, 23) self._label_lingotti.TabIndex = 25 self._label_lingotti.Text = "Cassa lingotti:" self._label_lingotti.TextAlign = ContentAlignment.MiddleRight # # label_gemme # self._label_gemme.Location = Point(6, 76) self._label_gemme.Name = "label_gemme" self._label_gemme.Size = Size(127, 23) self._label_gemme.TabIndex = 26 self._label_gemme.Text = "Cassa gemme:" self._label_gemme.TextAlign = ContentAlignment.MiddleRight # # groupBox_pet # self._groupBox_pet.Controls.Add(self._label_fireBeetle) self._groupBox_pet.Controls.Add(self._button_fireBeetle) self._groupBox_pet.Location = Point(12, 352) self._groupBox_pet.Name = "groupBox_pet" self._groupBox_pet.Size = Size(208, 50) self._groupBox_pet.TabIndex = 24 self._groupBox_pet.TabStop = False self._groupBox_pet.Text = "Pet" # # button_fireBeetle # self._button_fireBeetle.AccessibleName = "" self._button_fireBeetle.Location = Point(139, 14) self._button_fireBeetle.Name = "button_fireBeetle" self._button_fireBeetle.Size = Size(63, 25) self._button_fireBeetle.TabIndex = 17 self._button_fireBeetle.Text = "Imposta" self._button_fireBeetle.UseVisualStyleBackColor = True self._button_fireBeetle.Click += self.Button_fireBeetleClick # # label_fireBeetle # self._label_fireBeetle.Location = Point(6, 16) self._label_fireBeetle.Name = "label_fireBeetle" self._label_fireBeetle.Size = Size(127, 23) self._label_fireBeetle.TabIndex = 27 self._label_fireBeetle.Text = "Fire Beetle" self._label_fireBeetle.TextAlign = ContentAlignment.MiddleRight # # groupBox_output # self._groupBox_output.Controls.Add(self._textBox_output) self._groupBox_output.Location = Point(226, 12) self._groupBox_output.Name = "groupBox_output" self._groupBox_output.Size = Size(232, 431) self._groupBox_output.TabIndex = 25 self._groupBox_output.TabStop = False self._groupBox_output.Text = "Output" # # textBox_output # self._textBox_output.Location = Point(6, 14) self._textBox_output.Multiline = True self._textBox_output.Name = "textBox_output" self._textBox_output.ScrollBars = ScrollBars.Vertical self._textBox_output.Size = Size(220, 411) self._textBox_output.TabIndex = 2 # # button_Run # self._button_Run.AccessibleName = "" self._button_Run.BackColor = SystemColors.ControlLight self._button_Run.Location = Point(272, 449) self._button_Run.Name = "button_Run" self._button_Run.Size = Size(134, 32) self._button_Run.TabIndex = 28 self._button_Run.Text = "Run" self._button_Run.UseVisualStyleBackColor = True self._button_Run.Click += self.Button_RunClick # # groupBox_extra # self._groupBox_extra.Controls.Add(self._button_smelta) self._groupBox_extra.Controls.Add(self._button_scarico) self._groupBox_extra.Controls.Add(self._button_daiCibo) self._groupBox_extra.Location = Point(12, 408) self._groupBox_extra.Name = "groupBox_extra" self._groupBox_extra.Size = Size(208, 79) self._groupBox_extra.TabIndex = 28 self._groupBox_extra.TabStop = False self._groupBox_extra.Text = "Funzioni Extra" # # button_daiCibo # self._button_daiCibo.AccessibleName = "" self._button_daiCibo.Location = Point(6, 19) self._button_daiCibo.Name = "button_daiCibo" self._button_daiCibo.Size = Size(63, 25) self._button_daiCibo.TabIndex = 17 self._button_daiCibo.Text = "Sfama pet" self._button_daiCibo.UseVisualStyleBackColor = True self._button_daiCibo.Click += self.Button_daiCiboClick # # button_scarico # self._button_scarico.AccessibleName = "" self._button_scarico.Location = Point(70, 19) self._button_scarico.Name = "button_scarico" self._button_scarico.Size = Size(63, 25) self._button_scarico.TabIndex = 29 self._button_scarico.Text = "Scarica" self._button_scarico.UseVisualStyleBackColor = True self._button_scarico.Click += self.Button_scaricoClick # # button_smelta # self._button_smelta.AccessibleName = "" self._button_smelta.Location = Point(135, 19) self._button_smelta.Name = "button_smelta" self._button_smelta.Size = Size(63, 25) self._button_smelta.TabIndex = 30 self._button_smelta.Text = "Smelta" self._button_smelta.UseVisualStyleBackColor = True self._button_smelta.Click += self.Button_smeltaClick # # MainForm # self.ClientSize = Size(470, 499) self.Controls.Add(self._groupBox_extra) self.Controls.Add(self._button_Run) self.Controls.Add(self._groupBox_output) self.Controls.Add(self._groupBox_pet) self.Controls.Add(self._groupBox_casa) self.Controls.Add(self._groupBox_runebookCasa) self.Controls.Add(self._groupBox_minebook) self.FormBorderStyle = FormBorderStyle.Fixed3D self.Name = "MainForm" self.Text = "GiocoMiner 0.5" self.TopMost = True #self._groupBox_minebook.ResumeLayout(False) #self._groupBox_runebookCasa.ResumeLayout(False) #self._groupBox_casa.ResumeLayout(False) #self._groupBox_pet.ResumeLayout(False) #self._groupBox_output.ResumeLayout(False) #self._groupBox_output.PerformLayout() #self._groupBox_extra.ResumeLayout(False) #self.ResumeLayout(False) self._numericUpDown1.EndInit()
class SelectParameter(Form): def __init__(self): self.fm = doc.FamilyManager self._all_param_names = None self.Text = 'Параметры' self.Name = 'Select Parameters' self.Width = 210 self.Height = 400 self.title = Label() self.title.Text = "Выберете параметры" self.title.Height = 30 self.title.TextAlign = ContentAlignment.MiddleCenter self.title.Dock = DockStyle.Top self.combobox = ListBox() self.combobox.MultiColumn = False self.combobox.SelectionMode = SelectionMode.MultiExtended self.combobox.BeginUpdate() for i in self.all_param_names: self.combobox.Items.Add(i) self.combobox.EndUpdate() self.combobox.Height = 270 self.combobox.Location = Point(0, 30) self.combobox.Dock = DockStyle.Top self.button = Button() self.button.Text = "Выполнить" self.button.Dock = DockStyle.Top self.button.Click += self.change_param_type self.Controls.Add(self.button) self.Controls.Add(self.combobox) self.Controls.Add(self.title) self.handler = Execute_change_type() self.exEvent = ExternalEvent.Create(self.handler) @property def all_param_names(self): if self._all_param_names is None: self._all_param_names = [ i.Definition.Name for i in self.fm.GetParameters() if not i.IsInstance ] return self._all_param_names @property def graph(self): return [self.depend_of_param(i) for i in self.combobox.SelectedItems] def depend_of_param(self, param): res = {"param": param, "dep": []} for cur_param in self.all_param_names: if cur_param == param: continue f_param = self.fm.get_Parameter(cur_param) if f_param.IsDeterminedByFormula: templ = re.compile( "(^({0})[^A-Za-zА-Яа-я0-9_])|([^A-Za-zА-Яа-я0-9_]({0})[^A-Za-zА-Яа-я0-9_])|(({0})$)|(\[({0})\])" .format(param)) if templ.search(f_param.Formula): res["dep"].append(self.depend_of_param(cur_param)) return res def change_param_type(self, arg, prop): self.handler.graph = self.graph self.exEvent.Raise() self.Close()
class SelectParameter(Form): _all_param_group = {} def __init__(self): self.fm = doc.FamilyManager self._all_param_names = None self.Text = 'Параметры' self.Name = 'Select Parameters' self.Width = 400 self.Height = 450 self.title = Label() self.title.Text = "Выберете параметры" self.title.Height = 30 self.title.TextAlign = ContentAlignment.MiddleCenter self.title.Dock = DockStyle.Top self.label = Label() self.label.Text = "Выберете новую группу параметров" self.label.Height = 30 self.label.TextAlign = ContentAlignment.MiddleCenter self.label.Dock = DockStyle.Top self.listbox = ListBox() self.listbox.MultiColumn = False self.listbox.SelectionMode = SelectionMode.MultiExtended self.listbox.BeginUpdate() params = list(self.all_param_names.keys()) params.sort() for i in params: self.listbox.Items.Add(i) self.listbox.EndUpdate() self.listbox.Height = 270 self.listbox.Location = Point(0, 30) self.listbox.Dock = DockStyle.Top self.combobox = ComboBox() els = list(self.all_param_group.keys()) els.sort() for i in els: self.combobox.Items.Add(i) self.combobox.Location = Point(0, 300) self.combobox.Dock = DockStyle.Top self.button = Button() self.button.Text = "Перенести" self.button.Dock = DockStyle.Top self.button.Click += self.change_param_group self.Controls.Add(self.button) self.Controls.Add(self.combobox) self.Controls.Add(self.label) self.Controls.Add(self.listbox) self.Controls.Add(self.title) self.handler = Execute_change_group() self.exEvent = ExternalEvent.Create(self.handler) @property def all_param_names(self): if self._all_param_names is None: self._all_param_names = { "({}) {}".format( LabelUtils.GetLabelFor(i.Definition.ParameterGroup), i.Definition.Name): i for i in self.fm.GetParameters() } return self._all_param_names @property def all_param_group(self): if not self.__class__._all_param_group: els = { LabelUtils.GetLabelFor(getattr(BuiltInParameterGroup, i)): getattr(BuiltInParameterGroup, i) for i in dir(BuiltInParameterGroup) if i[0:2] == "PG" } self.__class__._all_param_group = els return self.__class__._all_param_group def change_param_group(self, arg, prop): self.handler._selected_params = [ self.all_param_names[i] for i in self.listbox.SelectedItems ] self.handler._selected_group = self.all_param_group[ self.combobox.SelectedItem] self.exEvent.Raise() self.Close()
def __init__(self): self.file_path = DEFAULT_PATH self.Text = 'Waypoint File Tool' self.Location = Point(0, 0) self.TopMost = ALWAYS_ON_TOP screen_size = Screen.GetWorkingArea(self) num_buttons = 3 btn_width = 150 margin = 5 start_x, start_y = 12, 10 self.Height = screen_size.Height self.Width = btn_width * num_buttons + margin * (num_buttons + 7) self.BackColor = CustomColor.MPDarkGray self.ForeColor = CustomColor.White """ OpenFileDialog does not appear to work in Mission Planner scripts... so, we create a rudimentary file picker with a textbox and listbox """ self.txt_path = TextBox() self.txt_path.Width = self.Width - (margin * 8) self.txt_path.BorderStyle = BorderStyle.FixedSingle self.txt_path.BackColor = CustomColor.MPLightGray self.txt_path.ForeColor = CustomColor.White self.txt_path.Text = self.file_path self.txt_path.LostFocus += self.refresh_filenames self.lst_files = ListBox() self.lst_files.Width = self.txt_path.Width self.lst_files.Height = self.Height / 5 self.lst_files.BorderStyle = BorderStyle.FixedSingle self.lst_files.BackColor = CustomColor.MPLightGray self.lst_files.ForeColor = CustomColor.White self.lst_files.SelectedIndexChanged += self.file_selection_changed self.btn_output_wp = Button() self.btn_output_wp.Width = 150 self.btn_output_wp.FlatStyle = FlatStyle.Flat self.btn_output_wp.FlatAppearance.BorderSize = 1 self.btn_output_wp.FlatAppearance.BorderColor = CustomColor.MPLightGray self.btn_output_wp.BackColor = CustomColor.MPGreen self.btn_output_wp.ForeColor = CustomColor.Black self.btn_output_wp.Text = 'Output as WP' self.btn_output_wp.Click += self.convert_file self.btn_output_poly = Button() self.btn_output_poly.Width = 150 self.btn_output_poly.FlatStyle = FlatStyle.Flat self.btn_output_poly.FlatAppearance.BorderSize = 1 self.btn_output_poly.FlatAppearance.BorderColor = CustomColor.MPLightGray self.btn_output_poly.BackColor = CustomColor.MPGreen self.btn_output_poly.ForeColor = CustomColor.Black self.btn_output_poly.Text = 'Output as POLY' self.btn_output_poly.Click += self.convert_file self.btn_refresh_files = Button() self.btn_refresh_files.Width = 150 self.btn_refresh_files.FlatStyle = FlatStyle.Flat self.btn_refresh_files.FlatAppearance.BorderSize = 1 self.btn_refresh_files.FlatAppearance.BorderColor = CustomColor.MPLightGray self.btn_refresh_files.BackColor = CustomColor.MPGreen self.btn_refresh_files.ForeColor = CustomColor.Black self.btn_refresh_files.Text = 'Refresh Files' self.btn_refresh_files.Click += self.refresh_filenames self.AcceptButton = self.btn_refresh_files self.spn_num_perimeter_passes = NumericUpDown() self.spn_num_perimeter_passes.Width = 40 self.spn_num_perimeter_passes.BorderStyle = BorderStyle.FixedSingle self.spn_num_perimeter_passes.BackColor = CustomColor.MPLightGray self.spn_num_perimeter_passes.ForeColor = CustomColor.White self.spn_num_perimeter_passes.Value = 3 self.chk_reverse_perimeter = CheckBox() self.chk_reverse_perimeter.FlatAppearance.BorderSize = 1 self.chk_reverse_perimeter.FlatAppearance.BorderColor = CustomColor.MPLightGray self.chk_reverse_perimeter.Text = 'Reverse Perimeter - Enter desired number of passes:' self.chk_reverse_perimeter.AutoSize = True self.chk_reverse_perimeter.CheckedChanged += self.set_txt_num_perimeter_passes_state self.chk_reverse_perimeter.Checked = True self.lbl_default_altitude = Label() self.lbl_default_altitude.Text = 'Waypoint Altitude (if unspecified):' self.lbl_default_altitude.AutoSize = True self.txt_default_altitude = TextBox() self.txt_default_altitude.Width = 50 self.txt_default_altitude.BorderStyle = BorderStyle.FixedSingle self.txt_default_altitude.BackColor = CustomColor.MPLightGray self.txt_default_altitude.ForeColor = CustomColor.White self.txt_default_altitude.MaxLength = 5 self.txt_default_altitude.TextAlign = HorizontalAlignment.Center self.txt_default_altitude.Text = str( round(DEFAULT_ALTITUDE * 3.28084, 2))[:5] self.txt_default_altitude.KeyPress += self.limit_to_decimal_digits self.cbo_default_altitude = ComboBox() self.cbo_default_altitude.Width = 60 self.cbo_default_altitude.DropDownStyle = ComboBoxStyle.DropDownList self.cbo_default_altitude.FlatStyle = FlatStyle.Flat self.cbo_default_altitude.BackColor = CustomColor.MPLightGray self.cbo_default_altitude.ForeColor = CustomColor.White self.cbo_default_altitude.DataSource = ['Feet', 'Meters'] self.cbo_default_altitude.SelectionChangeCommitted += self.convert_altitude_units self.lbl_status = Label() self.lbl_status.Text = 'Choose a file...' self.lbl_status.BackColor = CustomColor.MPMediumGray self.lbl_status.Width = self.txt_path.Width self.lbl_status.Height = self.txt_path.Height - 5 # pseudo-responsive form layout x, y = start_x, start_y x, y = self.add_control_vertical(self.txt_path, x, y, margin) x, y = self.add_control_vertical(self.lst_files, x, y, margin) x, y = self.add_control_horizontal(self.btn_output_wp, x, y, margin) x, y = self.add_control_horizontal(self.btn_output_poly, x, y, margin) x, y = self.add_control_vertical(self.btn_refresh_files, x, y, margin + 10) x, y = self.add_control_horizontal(self.chk_reverse_perimeter, start_x, y, margin) x, y = self.add_control_vertical(self.spn_num_perimeter_passes, x - 5, y, margin + 10) x, y = self.add_control_horizontal(self.lbl_default_altitude, start_x, y + 3, margin) x, y = self.add_control_horizontal(self.txt_default_altitude, x, y - 3, margin + 3) x, y = self.add_control_vertical(self.cbo_default_altitude, x, y, margin) self.Height = y + 100 self.add_control_vertical(self.lbl_status, start_x, self.Height - 60, margin) self.set_txt_num_perimeter_passes_state(None, None) self.refresh_filenames(None, None)
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)