예제 #1
0
   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
예제 #2
0
    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 __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())
        self.BackColor = Color.FromArgb(255, 255, 255)

        self.WindowState = FormWindowState.Normal
        self.CenterToScreen()
        self.BringToFront()
        self.TopMost = True

        screenSize = Screen.GetWorkingArea(self)
        self.Width = screenSize / 4
        self.Height = screenSize / 4

        uiWidth = self.DisplayRectangle.Width
        uiHeight = self.DisplayRectangle.Height

        spacing = 10

        userMessage = Label()
        font = Font("Helvetica", 10)
        userMessage.Text = message
        userMessage.Font = font
        userMessage.Location = Point(spacing, spacing)
        userMessage.Size = Size(uiWidth - (spacing * 2), (uiHeight / 4))
        self.Controls.Add(userMessage)
    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
예제 #6
0
    def _initialize_components(self):
        self._generate_menu_strip()
        self._create_buttons()

        flags_description = Label()
        flags_description.Parent = self
        flags_description.Text = 'Flags:'
        flags_description.Location = Point(10, 30)
        flags_description.Size = TextRenderer.MeasureText(
            flags_description.Text, flags_description.DefaultFont)

        self._result = Label()
        self._result.Parent = self
        self._result.Text = ''
        self._result.Size = TextRenderer.MeasureText(self._result.Text,
                                                     self._result.DefaultFont)
        self._result.Location = Point(
            self.Size.Width / 2 - self._result.Size.Width / 2 - 5, 30)

        self._flags_counter = Label()
        self._flags_counter.Parent = self
        self._flags_counter.Location = Point(45, 30)
        self._flags_counter.Size = Size(30, 20)

        self._label_timer = Label()
        self._label_timer.Parent = self
        self._label_timer.TextAlign = ContentAlignment.MiddleRight
        self._label_timer.Location = Point(self.Size.Width - 70, 30)
        self._label_timer.Size = Size(40, 20)
    def __init__(self, title, author):
        # Create the form
        self.Name = "Create Window"
        self.Text = title
        self.Size = Size(500, 150)
        self.CenterToScreen()

        self.value = ""

        # Create label for input title
        labelDiv = Label(Text=author + ":")
        labelDiv.Parent = self
        labelDiv.Size = Size(250, 250)
        labelDiv.Location = Point(30, 20)

        # Create TextBox for input
        self.textboxDiv = TextBox()
        self.textboxDiv.Parent = self
        self.textboxDiv.Text = "Date 1"
        self.textboxDiv.Size = Size(150, 150)
        self.textboxDiv.Location = Point(300, 20)

        # Create button
        button = Button()
        button.Parent = self
        button.Text = "Ok"
        button.Location = Point(300, 60)

        # Register event
        button.Click += self.ButtonClicked
예제 #8
0
    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
예제 #9
0
   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
예제 #10
0
    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
예제 #11
0
 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
예제 #12
0
   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
예제 #13
0
    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
예제 #14
0
    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
예제 #15
0
   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_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 __init__(self):

        self.Text = "You know I'm No Good"

        font = Font("Serif", 10)

        lyrics = Label()
        lyrics.Parent = self
        lyrics.Text = text
        lyrics.Font = font
        lyrics.Location = Point(10, 10)
        lyrics.Size = Size(390, 390)
        
        self.Size = Size(400,400)
        self.CenterToScreen()
예제 #18
0
 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
예제 #19
0
   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
예제 #20
0
 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
예제 #21
0
 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
예제 #22
0
 def __build_behaviourtab(self):
    ''' builds and returns the "Behaviour" Tab for the TabControl '''
    
    tabpage = TabPage()
    tabpage.Text = i18n.get("ConfigFormBehaviourTab")
    
    # 1. --- build the 'When scraping for the first time' label
    first_scrape_label = Label()
    first_scrape_label.AutoSize = False
    first_scrape_label.FlatStyle = FlatStyle.System
    first_scrape_label.Location = Point(52, 27)
    first_scrape_label.Text = i18n.get("ConfigFormFirstScrapeLabel")
    first_scrape_label.Size = Size(300, 17)
    
    # 1. --- build the 'autochoose series' checkbox
    self.__autochoose_series_cb = CheckBox()
    self.__autochoose_series_cb.AutoSize = False
    self.__autochoose_series_cb.FlatStyle = FlatStyle.System
    self.__autochoose_series_cb.Location = Point(82, 45)
    self.__autochoose_series_cb.Size = Size(300, 34)
    self.__autochoose_series_cb.Text =i18n.get("ConfigFormAutochooseSeriesCB")
    self.__autochoose_series_cb.CheckedChanged += self.__fired_update_gui
     
    # 2. --- build the 'confirm issue' checkbox
    self.__confirm_issue_cb = CheckBox()
    self.__confirm_issue_cb.AutoSize = False
    self.__confirm_issue_cb.FlatStyle = FlatStyle.System
    self.__confirm_issue_cb.Location = Point(82, 75)
    self.__confirm_issue_cb.Size = Size(300, 34)
    self.__confirm_issue_cb.Text = i18n.get("ConfigFormConfirmIssueCB")
    self.__confirm_issue_cb.CheckedChanged += self.__fired_update_gui
    
    # 3. -- build the 'use fast rescrape' checkbox
    self.__fast_rescrape_cb = CheckBox()
    self.__fast_rescrape_cb.AutoSize = False
    self.__fast_rescrape_cb.FlatStyle = FlatStyle.System
    self.__fast_rescrape_cb.Location = Point(52, 116)
    self.__fast_rescrape_cb.Size = Size(300, 34)
    self.__fast_rescrape_cb.Text = i18n.get("ConfigFormRescrapeCB")
    self.__fast_rescrape_cb.CheckedChanged += self.__fired_update_gui
    
    # 4. -- build the 'add rescrape hints to notes' checkbox
    self.__rescrape_notes_cb = CheckBox()
    self.__rescrape_notes_cb.AutoSize = False
    self.__rescrape_notes_cb.FlatStyle = FlatStyle.System
    self.__rescrape_notes_cb.Location = Point(82, 151)
    self.__rescrape_notes_cb.Size = Size(270, 17)
    self.__rescrape_notes_cb.Text = i18n.get("ConfigFormRescrapeNotesCB")
    self.__rescrape_notes_cb.CheckedChanged += self.__fired_update_gui
    
    # 5. -- build the 'add rescrape hints to tags' checkbox
    self.__rescrape_tags_cb = CheckBox()
    self.__rescrape_tags_cb.AutoSize = False
    self.__rescrape_tags_cb.FlatStyle = FlatStyle.System
    self.__rescrape_tags_cb.Location = Point(82, 181)
    self.__rescrape_tags_cb.Size = Size(270, 17)
    self.__rescrape_tags_cb.Text = i18n.get("ConfigFormRescrapeTagsCB")
    self.__rescrape_tags_cb.CheckedChanged += self.__fired_update_gui 
 
    # 6. --- build the 'specify series name' checkbox
    self.__summary_dialog_cb = CheckBox()
    self.__summary_dialog_cb.AutoSize = False
    self.__summary_dialog_cb.FlatStyle = FlatStyle.System
    self.__summary_dialog_cb.Location = Point(52, 214)
    self.__summary_dialog_cb.Size = Size(300, 34)
    self.__summary_dialog_cb.Text = i18n.get("ConfigFormShowSummaryCB")
    self.__summary_dialog_cb.CheckedChanged += self.__fired_update_gui 
          
    # 7. --- add 'em all to the tabpage 
    tabpage.Controls.Add(first_scrape_label)
    tabpage.Controls.Add(self.__autochoose_series_cb)
    tabpage.Controls.Add(self.__confirm_issue_cb)
    tabpage.Controls.Add(self.__fast_rescrape_cb)
    tabpage.Controls.Add(self.__rescrape_tags_cb)
    tabpage.Controls.Add(self.__rescrape_notes_cb)
    tabpage.Controls.Add(self.__summary_dialog_cb)
    
    return tabpage
예제 #23
0
 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
예제 #24
0
    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)
    def __init__(self, title):
        # Create the form
        self.Name = "Create Window"
        self.Text = title
        self.Size = Size(370, 590)
        self.CenterToScreen()

        self.value = ""
        self.value1 = ""
        self.value2 = ""
        self.value3 = ""
        self.value4 = ""
        self.value5 = ""
        self.value6 = ""
        self.value7 = ""
        self.value8 = ""
        self.finalValue = []

        # Create label for input title
        labelDiv = Label(Text="Door Type")
        labelDiv.Parent = self
        labelDiv.Size = Size(150, 20)
        labelDiv.Location = Point(30, 40)
        # Create TextBox for input
        self.textboxDiv = TextBox()
        self.textboxDiv.Parent = self
        self.textboxDiv.Text = ""
        self.textboxDiv.Location = Point(200, 40)

        # Create label for input title
        labelDiv1 = Label(Text="Door Frame Type")
        labelDiv1.Parent = self
        labelDiv1.Size = Size(150, 20)
        labelDiv1.Location = Point(30, 80)
        # Create TextBox for input
        self.textboxDiv1 = TextBox()
        self.textboxDiv1.Parent = self
        self.textboxDiv1.Text = ""
        self.textboxDiv1.Location = Point(200, 80)

        # Create label for input title
        labelDiv2 = Label(Text="Door Frame Finish")
        labelDiv2.Parent = self
        labelDiv2.Size = Size(150, 20)
        labelDiv2.Location = Point(30, 120)
        # Create TextBox for input
        self.textboxDiv2 = TextBox()
        self.textboxDiv2.Parent = self
        self.textboxDiv2.Text = ""
        self.textboxDiv2.Location = Point(200, 120)

        # Create label for input title
        labelDiv3 = Label(Text="Door Leaf Type")
        labelDiv3.Parent = self
        labelDiv3.Size = Size(150, 20)
        labelDiv3.Location = Point(30, 160)
        # Create TextBox for input
        self.textboxDiv3 = TextBox()
        self.textboxDiv3.Parent = self
        self.textboxDiv3.Text = ""
        self.textboxDiv3.Location = Point(200, 160)

        # Create label for input title
        labelDiv4 = Label(Text="Meeting Styles")
        labelDiv4.Parent = self
        labelDiv4.Size = Size(150, 20)
        labelDiv4.Location = Point(30, 200)
        # Create TextBox for input
        self.textboxDiv4 = TextBox()
        self.textboxDiv4.Parent = self
        self.textboxDiv4.Text = ""
        self.textboxDiv4.Location = Point(200, 200)

        # Create label for input title
        labelDiv5 = Label(Text="Door Leaf Material")
        labelDiv5.Parent = self
        labelDiv5.Size = Size(150, 20)
        labelDiv5.Location = Point(30, 240)
        # Create TextBox for input
        self.textboxDiv5 = TextBox()
        self.textboxDiv5.Parent = self
        self.textboxDiv5.Text = ""
        self.textboxDiv5.Location = Point(200, 240)

        # Create label for input title
        labelDiv6 = Label(Text="Door Leaf Finish")
        labelDiv6.Parent = self
        labelDiv6.Size = Size(150, 20)
        labelDiv6.Location = Point(30, 280)
        # Create TextBox for input
        self.textboxDiv6 = TextBox()
        self.textboxDiv6.Parent = self
        self.textboxDiv6.Text = ""
        self.textboxDiv6.Location = Point(200, 280)

        # Create label for input title
        labelDiv7 = Label(Text="Fire/Smoke")
        labelDiv7.Parent = self
        labelDiv7.Size = Size(150, 20)
        labelDiv7.Location = Point(30, 320)
        # Create TextBox for input
        self.textboxDiv7 = TextBox()
        self.textboxDiv7.Parent = self
        self.textboxDiv7.Text = ""
        self.textboxDiv7.Location = Point(200, 320)

        # Create label for input title
        labelDiv8 = Label(Text="Door Security")
        labelDiv8.Parent = self
        labelDiv8.Size = Size(150, 20)
        labelDiv8.Location = Point(30, 360)
        # Create TextBox for input
        self.textboxDiv8 = TextBox()
        self.textboxDiv8.Parent = self
        self.textboxDiv8.Text = ""
        self.textboxDiv8.Location = Point(200, 360)

        # Create label for input title
        labelDiv9 = Label(Text="Misc")
        labelDiv9.Parent = self
        labelDiv9.Size = Size(150, 20)
        labelDiv9.Location = Point(30, 400)
        # Create TextBox for input
        self.textboxDiv9 = TextBox()
        self.textboxDiv9.Parent = self
        self.textboxDiv9.Text = ""
        self.textboxDiv9.Location = Point(200, 400)

        # Create label for input title
        labelDiv10 = Label(Text="Comments")
        labelDiv10.Parent = self
        labelDiv10.Size = Size(150, 20)
        labelDiv10.Location = Point(30, 440)
        # Create TextBox for input
        self.textboxDiv10 = TextBox()
        self.textboxDiv10.Parent = self
        self.textboxDiv10.Text = ""
        self.textboxDiv10.Location = Point(200, 440)

        # Create button
        button = Button()
        button.Parent = self
        button.Text = "Ok"
        button.Location = Point(200, 490)
        button.Size = Size(100, 20)

        # Register event
        button.Click += self.ButtonClicked
    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
    def __build_behaviourtab(self):
        ''' builds and returns the "Behaviour" Tab for the TabControl '''

        tabpage = TabPage()
        tabpage.Text = i18n.get("ConfigFormBehaviourTab")

        # 1. --- build the 'When scraping for the first time' label
        first_scrape_label = Label()
        first_scrape_label.AutoSize = False
        first_scrape_label.FlatStyle = FlatStyle.System
        first_scrape_label.Location = Point(52, 27)
        first_scrape_label.Text = i18n.get("ConfigFormFirstScrapeLabel")
        first_scrape_label.Size = Size(300, 17)

        # 1. --- build the 'autochoose series' checkbox
        self.__autochoose_series_cb = CheckBox()
        self.__autochoose_series_cb.AutoSize = False
        self.__autochoose_series_cb.FlatStyle = FlatStyle.System
        self.__autochoose_series_cb.Location = Point(82, 45)
        self.__autochoose_series_cb.Size = Size(300, 34)
        self.__autochoose_series_cb.Text = i18n.get(
            "ConfigFormAutochooseSeriesCB")
        self.__autochoose_series_cb.CheckedChanged += self.__fired_update_gui

        # 2. --- build the 'confirm issue' checkbox
        self.__confirm_issue_cb = CheckBox()
        self.__confirm_issue_cb.AutoSize = False
        self.__confirm_issue_cb.FlatStyle = FlatStyle.System
        self.__confirm_issue_cb.Location = Point(82, 75)
        self.__confirm_issue_cb.Size = Size(300, 34)
        self.__confirm_issue_cb.Text = i18n.get("ConfigFormConfirmIssueCB")
        self.__confirm_issue_cb.CheckedChanged += self.__fired_update_gui

        # 3. -- build the 'use fast rescrape' checkbox
        self.__fast_rescrape_cb = CheckBox()
        self.__fast_rescrape_cb.AutoSize = False
        self.__fast_rescrape_cb.FlatStyle = FlatStyle.System
        self.__fast_rescrape_cb.Location = Point(52, 116)
        self.__fast_rescrape_cb.Size = Size(300, 34)
        self.__fast_rescrape_cb.Text = i18n.get("ConfigFormRescrapeCB")
        self.__fast_rescrape_cb.CheckedChanged += self.__fired_update_gui

        # 4. -- build the 'add rescrape hints to notes' checkbox
        self.__rescrape_notes_cb = CheckBox()
        self.__rescrape_notes_cb.AutoSize = False
        self.__rescrape_notes_cb.FlatStyle = FlatStyle.System
        self.__rescrape_notes_cb.Location = Point(82, 151)
        self.__rescrape_notes_cb.Size = Size(270, 17)
        self.__rescrape_notes_cb.Text = i18n.get("ConfigFormRescrapeNotesCB")
        self.__rescrape_notes_cb.CheckedChanged += self.__fired_update_gui

        # 5. -- build the 'add rescrape hints to tags' checkbox
        self.__rescrape_tags_cb = CheckBox()
        self.__rescrape_tags_cb.AutoSize = False
        self.__rescrape_tags_cb.FlatStyle = FlatStyle.System
        self.__rescrape_tags_cb.Location = Point(82, 181)
        self.__rescrape_tags_cb.Size = Size(270, 17)
        self.__rescrape_tags_cb.Text = i18n.get("ConfigFormRescrapeTagsCB")
        self.__rescrape_tags_cb.CheckedChanged += self.__fired_update_gui

        # 6. --- build the 'specify series name' checkbox
        self.__summary_dialog_cb = CheckBox()
        self.__summary_dialog_cb.AutoSize = False
        self.__summary_dialog_cb.FlatStyle = FlatStyle.System
        self.__summary_dialog_cb.Location = Point(52, 214)
        self.__summary_dialog_cb.Size = Size(300, 34)
        self.__summary_dialog_cb.Text = i18n.get("ConfigFormShowSummaryCB")
        self.__summary_dialog_cb.CheckedChanged += self.__fired_update_gui

        # 7. --- add 'em all to the tabpage
        tabpage.Controls.Add(first_scrape_label)
        tabpage.Controls.Add(self.__autochoose_series_cb)
        tabpage.Controls.Add(self.__confirm_issue_cb)
        tabpage.Controls.Add(self.__fast_rescrape_cb)
        tabpage.Controls.Add(self.__rescrape_tags_cb)
        tabpage.Controls.Add(self.__rescrape_notes_cb)
        tabpage.Controls.Add(self.__summary_dialog_cb)

        return tabpage