def __build_label(self, series_ref): ''' builds and returns the main text label for this form ''' # 1. compute the best possible full name for the given SeriesRef name_s = series_ref.series_name_s publisher_s = series_ref.publisher_s vol_year_n = series_ref.volume_year_n vol_year_s = sstr(vol_year_n) if vol_year_n > 0 else '' fullname_s = '' if name_s: if publisher_s: if vol_year_s: fullname_s = "'"+name_s+"' ("+publisher_s+", " + vol_year_s + ")" else: fullname_s = "'"+name_s+"' (" + publisher_s + ")" else: fullname_s = "'"+name_s+"'" label = Label() label.UseMnemonic = False sep = ' ' if len(fullname_s) > 40 else '\n' label.Text = i18n.get("IssueFormChooseText").format(fullname_s, sep) if self.__config.show_covers_b: label.Location = Point(218, 20) label.Size = Size(480, 40) else: label.Location = Point(10, 20) label.Size = Size(680, 40) return label
def __build_advancedtab(self): ''' builds and returns the "Advanced" Tab for the TabControl ''' tabpage = TabPage() tabpage.Text = i18n.get("ConfigFormAdvancedTab") # 1. --- a description label for this tabpage label = Label() label.UseMnemonic = False label.AutoSize = True label.Location = Point(14, 25) label.Size = Size(299, 17) label.Text = i18n.get("ConfigFormAdvancedText") # 2. --- build the update checklist (contains all the 'data' checkboxes) tbox = RichTextBox() tbox.Multiline = True tbox.MaxLength = 65536 tbox.WordWrap = True tbox.Location = Point(15, 50) tbox.Size = Size(355, 200) menu = ContextMenu() items = menu.MenuItems items.Add(MenuItem(i18n.get("TextCut"), lambda s, ea: tbox.Cut())) items.Add(MenuItem(i18n.get("TextCopy"), lambda s, ea: tbox.Copy())) items.Add(MenuItem(i18n.get("TextPaste"), lambda s, ea: tbox.Paste())) tbox.ContextMenu = menu self.__advanced_tbox = tbox # 3. --- add 'em all to the tabpage tabpage.Controls.Add(label) tabpage.Controls.Add(self.__advanced_tbox) return tabpage
def __build_label(self, series_ref): """ builds and returns the main text label for this form """ # 1. compute the best possible full name for the given SeriesRef name_s = series_ref.series_name_s publisher_s = series_ref.publisher_s vol_year_n = series_ref.volume_year_n vol_year_s = sstr(vol_year_n) if vol_year_n > 0 else "" fullname_s = "" if name_s: if publisher_s: if vol_year_s: fullname_s = "'" + name_s + "' (" + publisher_s + ", " + vol_year_s + ")" else: fullname_s = "'" + name_s + "' (" + publisher_s + ")" else: fullname_s = "'" + name_s + "'" label = Label() label.UseMnemonic = False sep = " " if len(fullname_s) > 40 else "\n" label.Text = i18n.get("IssueFormChooseText").format(fullname_s, sep) if self.__config.show_covers_b: label.Location = Point(218, 20) label.Size = Size(480, 40) else: label.Location = Point(10, 20) label.Size = Size(680, 40) return label
def __build_label(self): ''' builds and returns the text label for this form ''' label = Label() label.UseMnemonic = False label.Location = Point(10, 110 if self.__fail_label_is_visible else 10) label.Size = Size(415, 20) label.Text = i18n.get("SearchFormText") return label
def __build_label(self): ''' Builds and returns the label for this form. ''' label = Label() label.UseMnemonic = False label.Text = '' # updated everytime we start scraping a new comic label.Location = Point(13, 45) label.Size = Size(320, 15) label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right label.AutoSize = False return label
def __build_label(self): ''' Builds and returns the label for this form. ''' label = Label() label.UseMnemonic = False label.Text = '' # updated everytime we start scraping a new comic label.Location = Point(13, 45) label.Size = Size(320, 15) label.Anchor = AnchorStyles.Top | AnchorStyles.Left |AnchorStyles.Right label.AutoSize = False return label
def __build_fail_label(self, failed_search_s): ''' builds and returns the 'search failed' text label for this form. if there is no failed search terms, this returns None. ''' label = Label() label.UseMnemonic = False label.Location = Point(10, 10) label.Size = Size(415, 100) label.Visible = self.__fail_label_is_visible if self.__fail_label_is_visible: label.Text = i18n.get("SeriesSearchFailedText").format(failed_search_s) return label
def __build_skip_label(self, skipped_n): ''' Builds and returns the 'number skipped' Label for this form. 'skipped_n' -> the number of books that were skipped. ''' label = Label() label.UseMnemonic = False label.Location = Point(10, 30) label.Size = Size(280, 13) label.TextAlign = ContentAlignment.MiddleCenter label.Text = i18n.get("FinishFormSkippedSingle") if skipped_n==1 else \ i18n.get("FinishFormSkippedPlural").format(skipped_n) return label
def __build_fail_label(self, failed_search_s): ''' builds and returns the 'search failed' text label for this form. if there is no failed search terms, this returns None. ''' label = Label() label.UseMnemonic = False label.Location = Point(10, 10) label.Size = Size(415, 100) label.Visible = self.__fail_label_is_visible if self.__fail_label_is_visible: label.Text = i18n.get("SeriesSearchFailedText").format( failed_search_s) return label
def __build_comicvinetab(self): ''' builds and returns the "ComicVine" Tab for the TabControl ''' tabpage = TabPage() tabpage.Text = i18n.get("ConfigFormComicVineTab") tabpage.Name = "comicvine" # 1. --- a description label for this tabpage label = Label() label.UseMnemonic = False label.AutoSize = False label.Location = Point(34, 80) label.Size = Size(315, 54) label.Text = i18n.get("ConfigFormComicVineText") # 2. --- the API key text box fired_update_gui = self.__fired_update_gui class ApiKeyTextBox(TextBox): def OnTextChanged(self, args): fired_update_gui() self.__api_key_tbox = ApiKeyTextBox() tbox = self.__api_key_tbox tbox.Location = Point(34, 135) tbox.Size = Size(315, 1) menu = ContextMenu() items = menu.MenuItems items.Add(MenuItem(i18n.get("TextCut"), lambda s, ea: tbox.Cut())) items.Add(MenuItem(i18n.get("TextCopy"), lambda s, ea: tbox.Copy())) items.Add(MenuItem(i18n.get("TextPaste"), lambda s, ea: tbox.Paste())) tbox.ContextMenu = menu # 3. --- add a clickable link to send the user to ComicVine linklabel = LinkLabel() linklabel.UseMnemonic = False linklabel.AutoSize = False linklabel.Location = Point(34, 170) linklabel.Size = Size(315, 34) linklabel.Text = i18n.get("ConfigFormComicVineClickHere") linklabel.LinkClicked += self.__fired_linkclicked # 4. --- add 'em all to this tabpage tabpage.Controls.Add(label) tabpage.Controls.Add(tbox) tabpage.Controls.Add(linklabel) return tabpage
def __build_comicvinetab(self): ''' builds and returns the "ComicVine" Tab for the TabControl ''' tabpage = TabPage() tabpage.Text = i18n.get("ConfigFormComicVineTab") tabpage.Name = "comicvine" # 1. --- a description label for this tabpage label = Label() label.UseMnemonic = False label.AutoSize = False label.Location = Point(34, 80) label.Size = Size(315, 54) label.Text = i18n.get("ConfigFormComicVineText") # 2. --- the API key text box fired_update_gui = self.__fired_update_gui class ApiKeyTextBox(TextBox): def OnTextChanged(self, args): fired_update_gui() self.__api_key_tbox = ApiKeyTextBox() tbox = self.__api_key_tbox tbox.Location = Point(34, 135) tbox.Size = Size(315, 1) menu = ContextMenu() items = menu.MenuItems items.Add( MenuItem(i18n.get("TextCut"), lambda s, ea : tbox.Cut() ) ) items.Add( MenuItem(i18n.get("TextCopy"), lambda s, ea : tbox.Copy() ) ) items.Add( MenuItem(i18n.get("TextPaste"), lambda s, ea : tbox.Paste() ) ) tbox.ContextMenu = menu # 3. --- add a clickable link to send the user to ComicVine linklabel = LinkLabel() linklabel.UseMnemonic = False linklabel.AutoSize = False linklabel.Location = Point(34, 170) linklabel.Size = Size(315, 34) linklabel.Text = i18n.get("ConfigFormComicVineClickHere") linklabel.LinkClicked += self.__fired_linkclicked # 4. --- add 'em all to this tabpage tabpage.Controls.Add(label) tabpage.Controls.Add(tbox) tabpage.Controls.Add(linklabel) return tabpage
def __build_label(self, books): ''' Builds and returns the Label for this form. 'books' -> a list of all the comic books being scraped. ''' plural = len(books) != 1 label = Label() label.UseMnemonic = False label.AutoSize = True label.Location = Point(9, 10) label.Size = Size(319, 13) label.Text = i18n.get("WelcomeFormTextPlural").format(len(books)) \ if plural else i18n.get("WelcomeFormTextSingle") return label
def __build_label(self, search_terms_s, num_matches_n): ''' Builds and return the text label for this form. 'search_terms_s' -> user's search string that was used to find series 'num_matches_n' -> number of series (table rows) the user's search matched ''' label = Label() label.UseMnemonic = False label.Location = Point(10, 20) label.Size = Size(480, 40) if num_matches_n > 1: label.Text = i18n.get("SeriesFormChooseText")\ .format(search_terms_s, num_matches_n ) else: label.Text = i18n.get("SeriesFormConfirmText").format(search_terms_s) return label
def __build_advancedtab(self): ''' builds and returns the "Advanced" Tab for the TabControl ''' tabpage = TabPage() tabpage.Text = i18n.get("ConfigFormAdvancedTab") # 1. --- a description label for this tabpage label = Label() label.UseMnemonic = False label.AutoSize = True label.Location = Point(14, 25) label.Size = Size(299, 17) label.Text = i18n.get("ConfigFormAdvancedText") # 2. --- build the update checklist (contains all the 'data' checkboxes) tbox = RichTextBox() tbox.Multiline=True tbox.MaxLength=65536 tbox.WordWrap = True tbox.Location = Point(15, 50) tbox.Size = Size(355, 200) menu = ContextMenu() items = menu.MenuItems items.Add( MenuItem(i18n.get("TextCut"), lambda s, ea : tbox.Cut() ) ) items.Add( MenuItem(i18n.get("TextCopy"), lambda s, ea : tbox.Copy() ) ) items.Add( MenuItem(i18n.get("TextPaste"), lambda s, ea : tbox.Paste() ) ) tbox.ContextMenu = menu self.__advanced_tbox = tbox # 3. --- add 'em all to the tabpage tabpage.Controls.Add(label) tabpage.Controls.Add(self.__advanced_tbox) return tabpage
def __build_detailstab(self): ''' builds and returns the "Details" Tab for the TabControl ''' tabpage = TabPage() tabpage.Text = i18n.get("ConfigFormDetailsTab") tabpage.Name = "details" # 1. --- a description label for this tabpage label = Label() label.UseMnemonic = False label.AutoSize = True label.Location = Point(14, 35) label.Size = Size(299, 17) label.Text = i18n.get("ConfigFormDetailsText") # 2. --- the 'select all' button checkall_button = Button() checkall_button.Click += self.__fired_checkall checkall_button.Location = Point(280, 107) checkall_button.Size = Size(100, 23) checkall_button.Text = i18n.get("ConfigFormDetailsAll") # 3. --- the 'deselect all' button uncheckall_button = Button() uncheckall_button.Click += self.__fired_uncheckall uncheckall_button.Location = Point(280, 138) uncheckall_button.Size = Size(100, 23) uncheckall_button.Text = i18n.get("ConfigFormDetailsNone") # 4. --- build the update checklist (contains all the 'data' checkboxes) self.__update_checklist = CheckedListBox() self.__update_checklist.CheckOnClick = True self.__update_checklist.ColumnWidth = 125 self.__update_checklist.ThreeDCheckBoxes = True self.__update_checklist.Location = Point(15, 65) self.__update_checklist.MultiColumn = True self.__update_checklist.SelectionMode = SelectionMode.One self.__update_checklist.Size = Size(260, 170) self.__update_checklist.ItemCheck += self.__fired_update_gui self.__update_checklist.Items.Add(ConfigForm.__SERIES_CB) self.__update_checklist.Items.Add(ConfigForm.__VOLUME_CB) self.__update_checklist.Items.Add(ConfigForm.__NUMBER_CB) self.__update_checklist.Items.Add(ConfigForm.__TITLE_CB) self.__update_checklist.Items.Add(ConfigForm.__PUBLISHED_CB) self.__update_checklist.Items.Add(ConfigForm.__RELEASED_CB) self.__update_checklist.Items.Add(ConfigForm.__CROSSOVERS_CB) self.__update_checklist.Items.Add(ConfigForm.__PUBLISHER_CB) self.__update_checklist.Items.Add(ConfigForm.__IMPRINT_CB) self.__update_checklist.Items.Add(ConfigForm.__WRITER_CB) self.__update_checklist.Items.Add(ConfigForm.__PENCILLER_CB) self.__update_checklist.Items.Add(ConfigForm.__INKER_CB) self.__update_checklist.Items.Add(ConfigForm.__COLORIST_CB) self.__update_checklist.Items.Add(ConfigForm.__LETTERER_CB) self.__update_checklist.Items.Add(ConfigForm.__COVER_ARTIST_CB) self.__update_checklist.Items.Add(ConfigForm.__EDITOR_CB) self.__update_checklist.Items.Add(ConfigForm.__SUMMARY_CB) self.__update_checklist.Items.Add(ConfigForm.__CHARACTERS_CB) self.__update_checklist.Items.Add(ConfigForm.__TEAMS_CB) self.__update_checklist.Items.Add(ConfigForm.__LOCATIONS_CB) self.__update_checklist.Items.Add(ConfigForm.__WEBPAGE_CB) # 5. --- add 'em all to this tabpage tabpage.Controls.Add(label) tabpage.Controls.Add(checkall_button) tabpage.Controls.Add(uncheckall_button) tabpage.Controls.Add(self.__update_checklist) return tabpage