def __init__(self, param): super(PanelDate, self).__init__() self.Height = 170 self.paramtype = param[1] tooltips = ToolTip() self.value = '' self.textlabel = Label() self.textlabel.Parent = self self.textlabel.Text = param[0] + ' :' self.textlabel.Location = Point(0, 0) self.textlabel.Size = Size(Fconfig.lblwidth, Fconfig.unitline * 2) self.textlabel.TextAlign = ContentAlignment.MiddleLeft self.textbox = TextBox() self.textbox.Parent = self self.textbox.Text = Fconfig.defdate self.textbox.Location = Point(0, Fconfig.unitline * 2) self.textbox.Width = Fconfig.lblwidth - Fconfig.margin self.textbox.TextAlign = HorizontalAlignment.Center self.textbox.TextChanged += self.onInput self.calend = MonthCalendar() self.calend.Parent = self self.calend.Location = Point(Fconfig.lblwidth + 5, 0) self.calend.MaxSelectionCount = 1 self.calend.DateChanged += self.onSelect tooltips.SetToolTip(self.calend, Types.types(param[1], 'tooltip')) ModeDBG.say('panel {0}, top {1}, height :{2}'.format( param[1], self.Top, self.Height))
def __init__(self, param): super(PanelBool, self).__init__() self.Height = Fconfig.unitline tooltips = ToolTip() self.value = True self.textlabel = Label() self.textlabel.Parent = self self.textlabel.Text = param[0] + ' :' self.textlabel.Location = Point(0, 0) self.textlabel.Size = Size(Fconfig.lblwidth, Fconfig.unitline) self.textlabel.TextAlign = ContentAlignment.MiddleLeft self.checkyes = RadioButton() self.checkyes.Parent = self self.checkyes.Location = Point( self.textlabel.Right + 2 * Fconfig.margin, 10) self.checkyes.Text = Fconfig.buttonYES self.checkyes.Checked = True self.checkyes.CheckedChanged += self.onChanged self.checkno = RadioButton() self.checkno.Parent = self self.checkno.Location = Point(self.checkyes.Right, 10) self.checkno.Text = Fconfig.buttonNO self.checkno.CheckedChanged += self.onChanged tooltips.SetToolTip(self, Types.types(param[1], 'tooltip')) ModeDBG.say('panel {0}, top {1}, height :{2}'.format( param[1], self.Top, self.Height))
def __init__(self): self.Text = "Tooltips" self.CenterToScreen() self.Size = Size(200, 150) tooltip = ToolTip() tooltip.SetToolTip(self, "This is a Form") button = Button() button.Parent = self button.Text = "Button" button.Location = Point(50, 70) tooltip.SetToolTip(button, "This is a Button")
def __init__(self): TreeView.__init__(self) self.Dock = DockStyle.Fill self.ShowLines = False self.TabIndex = 0 #self.BorderStyle = BorderStyle.None self.BackColor = UIGlobal.leftPanelColor self.FullRowSelect = True self.HideSelection = False # Keep selected item grey when lost focus tooltip = ToolTip() tooltip.IsBalloon = True tooltip.SetToolTip(self, "Double-click a module to add it to the collection.")
def __init__(self): TreeView.__init__(self) self.Dock = DockStyle.Fill self.ShowLines = False self.TabIndex = 0 #self.BorderStyle = BorderStyle.None self.BackColor = UIGlobal.leftPanelColor self.FullRowSelect = True self.HideSelection = False # Keep selected item grey when lost focus tooltip = ToolTip() tooltip.IsBalloon = True tooltip.SetToolTip( self, "Double-click a module to add it to the collection.")
def __init__(self): self.Text = 'Tooltips' self.CenterToScreen() xsize, ysize = 300, 200 self.Size = Size(xsize, ysize) tooltip = ToolTip() tooltip.SetToolTip(self, "This is a Form") button = Button() button.Parent = self button.Text = "Button" xloc, yloc = 50, 70 button.Location = Point(xloc, yloc) tooltip.SetToolTip(button, "This is a Button")
def __init__(self): ListView.__init__(self) self.Dock = DockStyle.Fill # behaviour self.LabelEdit = True # allow renaming self.Sorting = SortOrder.Ascending self.MultiSelect = False # appearance self.View = View.SmallIcon self.ShowLines = True self.TabIndex = 0 self.BackColor = UIGlobal.leftPanelColor self.HideSelection = False # Keep selected item grey when lost focus tooltip = ToolTip() tooltip.IsBalloon = True tooltip.SetToolTip(self, "Double-click a collection to select it.")
def __init__(self, param): super(PanelParameter, self).__init__() self.Height = Fconfig.unitline self.paramtype = param[1] tooltips = ToolTip() self.value = '' self.textlabel = Label() self.textlabel.Parent = self self.textlabel.Text = '{0} ({1}) :'.format(param[0], param[1]) self.textlabel.Location = Point(0, 0) self.textlabel.Size = Size(Fconfig.lblwidth, Fconfig.unitline) self.textlabel.TextAlign = ContentAlignment.MiddleLeft #ComboBox if list if len(param) >= 3: self.textbox = ComboBox() list_items = List[Object](param[2]) self.textbox.Items.AddRange(list_items.ToArray()) #dropdownstyle with 4th param if False: if len(param) > 3 and not param[3]: self.textbox.DropDownStyle = ComboBoxStyle.DropDownList self.textbox.SelectionChangeCommitted += self.onInput #else simple textbox else: self.textbox = TextBox() self.textbox.Parent = self self.textbox.Location = Point(self.textlabel.Right + Fconfig.margin, 10) self.textbox.Width = Fconfig.smwidth - self.textlabel.Width - 2 * Fconfig.margin self.textbox.TextChanged += self.onInput tooltips.SetToolTip(self.textbox, Types.types(param[1], 'tooltip')) ModeDBG.say('panel {0}, top {1}, height :{2}'.format( param[1], self.Top, self.Height))
class FTPanel(Panel): def __InitToolBar(self): # (Handler, Text, Image, Tooltip) ButtonList = [ (self.__ChooseDatabase, "Choose Database", "FLEX", "Select the FieldWorks database to operate on"), (self.__EditCollections, "Collections", "copy", "Manage and select a collection of modules"), None, # Separator (self.__ShowInfo, "Module Info", "documents", "Show the full module documentation"), #(None, # "Configure", # "applications", # "Edit configuration parameters for this module"), None, # Separator (self.RunOne, "Run", "arrow-forward", "Run selected module in dry-run mode"), (self.RunAll, "Run All", "arrow-forward-double", "Run all modules in dry-run mode"), (self.RunOneModify, "Run (Modify)", "arrow-forward-!", "Run selected module with database changes enabled"), (self.RunAllModify, "Run All (Modify)", "arrow-forward-double-!", "Run all modules with database changes enabled") ] return CDFDotNetUtils.CDFToolBar(ButtonList, UIGlobal.ToolbarIconParams) def __init__(self, moduleManager, dbName, listOfModules, reloadFunction, progressFunction): Panel.__init__(self) self.Dock = DockStyle.Fill self.Font = UIGlobal.normalFont # -- Toolbar self.toolbar = self.__InitToolBar() self.__EditCollectionsHandler = None # -- Module list and Report window self.moduleManager = moduleManager self.dbName = dbName self.listOfModules = listOfModules self.reloadFunction = reloadFunction self.modulesList = UIModulesList.ModulesList(self.moduleManager, self.listOfModules) self.modulesList.SetActivatedHandler(self.RunOne) self.reportWindow = UIReport.ReportWindow() startupTips = [] if dbName: self.UpdateDatabaseName(dbName) else: msg = "Choose a database by clicking the Choose Database button in the toolbar." startupTips.append(msg) if not self.listOfModules: msg = "Choose or create a collection by clicking the Collections button in the toolbar." startupTips.append(msg) for msg in startupTips: self.reportWindow.Report(msg) self.reportWindow.Report("Use the Run buttons to run Modules.") if startupTips: self.startupTip = ToolTip() self.startupTip.IsBalloon = True self.startupTip.ToolTipTitle = "Getting started" self.startupTip.InitialDelay = 0 self.startupTip.AutoPopDelay = 20000 self.startupTip.SetToolTip(self.modulesList, "\n".join(startupTips)) else: self.startupTip = None self.reportWindow.Reporter.RegisterProgressHandler(progressFunction) # -- 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.Horizontal self.splitContainer1.Panel1.Controls.Add(self.modulesList) self.splitContainer1.Panel2.Controls.Add(self.reportWindow) ## Add the main SplitContainer control to the panel. self.Controls.Add(self.splitContainer1) self.Controls.Add(self.toolbar) # Last in takes space priority # ---- Toolbar button handlers ---- def __EditCollections(self): if self.startupTip: self.startupTip.RemoveAll() if self.__EditCollectionsHandler: self.__EditCollectionsHandler() def __ChooseDatabase(self): if self.startupTip: self.startupTip.RemoveAll() if self.__ChooseDatabaseHandler: self.__ChooseDatabaseHandler() def __ShowInfo(self): if self.modulesList.SelectedIndex >= 0: module = self.listOfModules[self.modulesList.SelectedIndex] moduleDocs = self.moduleManager.GetDocs(module) if moduleDocs: infoDialog = UIModuleBrowser.ModuleInfoDialog(moduleDocs) infoDialog.ShowDialog() def __Run(self, message, modules, modifyDB = False): # Reload the Modules to make sure we're using the latest code. if self.reloadFunction: self.reloadFunction() if not self.dbName: self.reportWindow.Reporter.Error("No database selected! Use the Database button in the toolbar.") return if not modifyDB: modifyDB = (Control.ModifierKeys == Keys.Shift) self.reportWindow.Clear() if modifyDB: dlgmsg = "Are you sure you want to make changes to the '%s' database? "\ "(Please backup the project first.)" title = "Confirm allow changes" result = MessageBox.Show(dlgmsg % self.dbName, title, MessageBoxButtons.YesNo, MessageBoxIcon.Question) if (result == DialogResult.No): return message += " (Changes enabled)" self.reportWindow.Reporter.Info(message) self.reportWindow.Refresh() self.moduleManager.RunModules(self.dbName, modules, self.reportWindow.Reporter, modifyDB) # Make sure the progress indicator is off self.reportWindow.Reporter.ProgressStop() def RunAll(self, modify=False): self.__Run("Running all modules...", self.listOfModules, modify) def RunOne(self, modify=False): if self.modulesList.SelectedIndex >= 0: self.__Run("Running single module...", [self.listOfModules[self.modulesList.SelectedIndex]], modify) def RunAllModify(self): self.RunAll(True) def RunOneModify(self): self.RunOne(True) # ---- Externally used methods ---- def SetChooseDatabaseHandler(self, handler): self.__ChooseDatabaseHandler = handler def SetEditCollectionsHandler(self, handler): self.__EditCollectionsHandler = handler def UpdateModuleList(self, collectionName, listOfModules): self.listOfModules = listOfModules self.modulesList.UpdateAllItems(self.listOfModules) self.reportWindow.Report("Collection '%s' selected." % collectionName) def UpdateDatabaseName(self, newDatabaseName): self.dbName = newDatabaseName self.reportWindow.Report("Database '%s' selected." % self.dbName) self.toolbar.UpdateButtonText(0, self.dbName) def RefreshModules(self): self.modulesList.UpdateAllItems(self.listOfModules, keepSelection=True)
def __init__(self, moduleManager, dbName, listOfModules, reloadFunction, progressFunction): Panel.__init__(self) self.Dock = DockStyle.Fill self.Font = UIGlobal.normalFont # -- Toolbar self.toolbar = self.__InitToolBar() self.__EditCollectionsHandler = None # -- Module list and Report window self.moduleManager = moduleManager self.dbName = dbName self.listOfModules = listOfModules self.reloadFunction = reloadFunction self.modulesList = UIModulesList.ModulesList(self.moduleManager, self.listOfModules) self.modulesList.SetActivatedHandler(self.RunOne) self.reportWindow = UIReport.ReportWindow() startupTips = [] if dbName: self.UpdateDatabaseName(dbName) else: msg = "Choose a database by clicking the Choose Database button in the toolbar." startupTips.append(msg) if not self.listOfModules: msg = "Choose or create a collection by clicking the Collections button in the toolbar." startupTips.append(msg) for msg in startupTips: self.reportWindow.Report(msg) self.reportWindow.Report("Use the Run buttons to run Modules.") if startupTips: self.startupTip = ToolTip() self.startupTip.IsBalloon = True self.startupTip.ToolTipTitle = "Getting started" self.startupTip.InitialDelay = 0 self.startupTip.AutoPopDelay = 20000 self.startupTip.SetToolTip(self.modulesList, "\n".join(startupTips)) else: self.startupTip = None self.reportWindow.Reporter.RegisterProgressHandler(progressFunction) # -- 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.Horizontal self.splitContainer1.Panel1.Controls.Add(self.modulesList) self.splitContainer1.Panel2.Controls.Add(self.reportWindow) ## Add the main SplitContainer control to the panel. self.Controls.Add(self.splitContainer1) self.Controls.Add(self.toolbar) # Last in takes space priority
def __init__(self, ref_obj): super(RevitPythonHelper, self).__init__() self.ref_obj = ref_obj self.filter_sys_memb = True self.Size = Size(650, 800) self.Text = 'Explorer' self.tooltips = ToolTip() self.StartPosition = FormStartPosition.Manual # self.Location = Point(600,0) # to display in your favorite corner self.panright = SplitContainer() self.panright.Parent = self self.panright.Dock = DockStyle.Fill self.panright.Orientation = Orientation.Horizontal self.panright.SplitterDistance = 100 self.top_info = RichTextBox() self.top_info.Dock = DockStyle.Fill self.top_info.DetectUrls = True self.table = DataGridView() self.table.Dock = DockStyle.Fill self.table.RowHeadersVisible = False self.table.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders self.table.RowTemplate.Height = 30 self.table.SelectionMode = DataGridViewSelectionMode.RowHeaderSelect self.table.DefaultCellStyle.WrapMode = DataGridViewTriState. True self.table.DefaultCellStyle.BackColor = Color.GhostWhite self.table.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter col1 = DataGridViewTextBoxColumn() col1.HeaderText = 'Name' col1.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill col1.FillWeight = 20 col1.DefaultCellStyle.Font = Font(self.table.DefaultCellStyle.Font, FontStyle.Underline) col2 = DataGridViewTextBoxColumn() col2.HeaderText = 'Type' col2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill col2.FillWeight = 5 col2.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter col3 = DataGridViewTextBoxColumn() col3.HeaderText = 'Value' col3.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill col3.FillWeight = 15 col4 = DataGridViewTextBoxColumn() col4.HeaderText = 'Infos' col4.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill col4.FillWeight = 60 self.table.Columns.AddRange((col1, col2, col3, col4)) self.table.AutoGenerateColumns = False self.panright.Panel1.Controls.Add(self.top_info) self.panright.Panel2.Controls.Add(self.table) self.panright.FixedPanel = FixedPanel.Panel1 self.toolpan = FlowLayoutPanel() self.toolpan.Parent = self self.toolpan.Dock = DockStyle.Top self.toolpan.Height = 25 self.check = CheckBox() self.check.Parent = self.toolpan self.check.Text = "Hide Sys" self.check.Checked = True self.close = Button() self.close.Parent = self self.close.Dock = DockStyle.Bottom self.close.Text = 'Close' self.close.Height = 30 # LOAD DATAS self.update_info(extract_main(self.ref_obj)) self.update_table(extract_members(self.ref_obj, self.filter_sys_memb)) self.Show() # EVENTS self.top_info.LinkClicked += self.on_link_clicked self.check.CheckedChanged += self.on_hide_member_clicked self.close.Click += self.on_close self.table.MouseEnter += self.get_focus self.table.CellContentDoubleClick += self.on_val_double_click