def __init__(self): ''' Creates a _PictureBoxPanel. Call set_image after initialization. ''' # the left and right arrow Image objects self.__left_arrow = Resources.createArrowIcon(True, False) self.__full_left_arrow = Resources.createArrowIcon(True, True) self.__right_arrow = Resources.createArrowIcon(False, False) self.__full_right_arrow = Resources.createArrowIcon(False, True) # the vertical line boundary between the full_left and left arrow's # 'clickable columns' and the full_right and right arrow's. self.__left_bound = 0 self.__right_bound = 0 # the image attributes to use for drawing non-alpha blended images self.__hovered_image_atts = None # the image attributes to use for drawing alpha blended images self.__normal_image_atts = None # a string indicating whether the mouse is hovered over the full # left ('FL'), left ('L'), right ('R'), or full right ('FR') side of # this panel, or None if the mouse isn't over the panel at all. self.__mouse_hovered_state = None # our PictureBox object, which we center and stretch as needed self._picbox = None Panel.__init__(self) self.__build_gui()
def __init__(self, modules): Panel.__init__(self) self.modules = modules self.Dock = DockStyle.Fill self.moduleActivatedHandler = None # The infoPane contents is initialised through AfterSelect event # from ModuleTree self.infoPane = ModuleInfoPane() self.moduleTree = ModuleTree() for m in self.modules.ListOfNames(): self.moduleTree.AddModuleName(m) self.moduleTree.ExpandAll() self.moduleTree.SetSelectedHandler(self.TreeNodeSelected) self.splitContainer1 = SplitContainer() self.splitContainer1.Dock = DockStyle.Fill self.splitContainer1.TabIndex = 1 self.splitContainer1.SplitterWidth = UIGlobal.SPLITTER_WIDTH self.splitContainer1.SplitterDistance = 70 self.splitContainer1.Orientation = Orientation.Vertical self.splitContainer1.Panel1.Controls.Add(self.moduleTree) self.splitContainer1.Panel2.Controls.Add(self.infoPane) ## Add the main SplitContainer control to the panel. self.Controls.Add(self.splitContainer1)
def __init__(self): ''' Creates a _PictureBoxPanel. Call set_image after initialization. ''' # the left and right arrow Image objects self.__left_arrow = Resources.createArrowIcon(True, False) self.__full_left_arrow = Resources.createArrowIcon(True, True) self.__right_arrow = Resources.createArrowIcon(False, False) self.__full_right_arrow = Resources.createArrowIcon(False, True) # the vertical line boundary between the full_left and left arrow's # 'clickable columns' and the full_right and right arrow's. self.__left_bound = 0; self.__right_bound = 0; # the image attributes to use for drawing non-alpha blended images self.__hovered_image_atts = None # the image attributes to use for drawing alpha blended images self.__normal_image_atts = None # a string indicating whether the mouse is hovered over the full # left ('FL'), left ('L'), right ('R'), or full right ('FR') side of # this panel, or None if the mouse isn't over the panel at all. self.__mouse_hovered_state = None # our PictureBox object, which we center and stretch as needed self._picbox = None Panel.__init__(self) self.__build_gui()
def __init__(self, config, issue_num_hint_s=None): ''' Initializes this panel. 'config' -> the shared global Configuration object 'issue_num_hint_s' -> issue number to use for figuring out which cover art to display when the currently set ref is a SeriesRef. ''' # the shared global configuration self.__config = config # the issue number to use when finding cover art for a SeriesRef self.__issue_num_hint_s = issue_num_hint_s # a PictureBox that displays the cover art for the current selected issue self.__coverpanel = None # a linklabel describing the currently displayed cover image self.__label = None # the function that gets called if a link on self.__label gets clicked self.__link_callback = None # the "next" button for seeing a ref's next available cover self.__nextbutton = None # the "prev" button for seeing a ref's previous cover self.__prevbutton = None # the IssueRef or SeriesRef whose cover we are currently displaying self.__ref = None # a mapping of refs to _ButtonModels. Basically caches the # next/prev button state for each ref. self.__button_cache = {} # a mapping of SeriesRefs to IssueRefs (or SeriesRefs). this cache lets # us avoid querying the database twice for the same SeriesRef. self.__series_cache = {} # a scheduler (thread) for finding cover images... self.__finder_scheduler = Scheduler() # a scheduler (thread) for setting new refs... self.__setter_scheduler = Scheduler() # a tuple containing the user's alternate cover art choice (a url) for # a specific IssueRef i.e. (IssuRef, url). none if no alt choice was made. self.__alt_cover_choice = None Panel.__init__(self) self.__build_gui()
def __init__(self, pictureBox): Panel.__init__(self) # This makes the panel selectable, and therefore scrollable # with the mouse wheel self.SetStyle(ControlStyles.Selectable, True) self.Dock = DockStyle.Fill self.AutoScroll = True self.image = pictureBox.Image self.sizeMode = pictureBox.SizeMode pictureBox.Parent = self pictureBox.Click += lambda *_: self.Focus() self.Click += lambda *_: self.Focus()
def __init__(self, tweet): Panel.__init__(self) self.tweet = tweet self.Height = HEIGHT self.imageBox = imageBox = PictureBox(Height=HEIGHT, Width=HEIGHT) imageBox.Image = getImage(tweet) imageBox.Anchor = AnchorStyles.Left imageBox.Parent = self halfway = (self.ClientSize.Width - imageBox.Width) / 2 self.friendLabel = friendLabel = Label(Text=tweet['screen_name'], TextAlign=ContentAlignment.MiddleLeft) friendLabel.Font = Font(friendLabel.Font, friendLabel.Font.Style | FontStyle.Bold) friendLabel.Left = imageBox.Width friendLabel.Anchor = AnchorStyles.Left | AnchorStyles.Right friendLabel.Width = halfway friendLabel.Parent = self self.dateLabel = dateLabel = Label(Text=str(tweet['created']), TextAlign=ContentAlignment.MiddleRight) dateLabel.Width = halfway dateLabel.Left = self.Width - dateLabel.Width - 10 # scrollbar dateLabel.Anchor = AnchorStyles.Left | AnchorStyles.Right dateLabel.Parent = self dateLabel.BringToFront() self.tweetLabel = tweetLabel = Label(Text=tweet['text']) tweetLabel.Left = self.imageBox.Width tweetLabel.Top = friendLabel.Height tweetLabel.Width = self.Width - self.imageBox.Width tweetLabel.Height = self.Height - friendLabel.Height tweetLabel.Anchor = (AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom) tweetLabel.Parent = self
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, 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, moduleManager, projectName, 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.projectName = projectName 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 projectName: self.UpdateProjectName(projectName) else: msg = "Choose a project by clicking the Choose Project 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