Ejemplo n.º 1
0
    def __init__(self, parent, preferences, **options):
        super(MainPage, self).__init__(parent, **options)
        self._label_text = None
        self._label = None
        self._apiTokenEntry = None
        self._apiToken = tk.StringVar()
        self._urlEntry = None
        self._url = tk.StringVar()

        self.pack(fill=tk.BOTH, expand=tk.TRUE)

        self._apiToken.set(preferences.get_token(''))
        self._url.set(preferences.get_url(Preferences.URL))

        ttk.Label(self,
                  text="Token:",
                  borderwidth=0,
                  anchor=tk.E).grid(row=0, column=0, pady=5, sticky='nsew')
        self._apiTokenEntry = EntryCustom(self,
                                          textvariable=self._apiToken,
                                          width=120,
                                          state=tk.NORMAL)
        self._apiTokenEntry.grid(row=0, column=1, pady=5, sticky='nsew')
        ttk.Label(self,
                  text="URL:",
                  borderwidth=0,
                  anchor=tk.E).grid(row=1, column=0, pady=5, sticky='nsew')
        self._urlEntry = EntryCustom(self,
                                     textvariable=self._url,
                                     width=80,
                                     state=tk.NORMAL)
        self._urlEntry.grid(row=1, column=1, pady=5, sticky='nsw')

        self.initial_focus = self._apiTokenEntry
Ejemplo n.º 2
0
 def body(self, parent, options):
     ttk.Label(parent, text="Protocol:", borderwidth=0,
               anchor=tk.E).grid(padx=7, pady=6, row=0, sticky='nse')
     self._protocol = EntryCustom(parent, state=tk.NORMAL)
     self._protocol.grid(padx=(0, 7), pady=6, row=0, column=1, sticky='nsw')
     ttk.Label(parent, text="URL:", borderwidth=0,
               anchor=tk.E).grid(padx=7, pady=6, row=1, sticky='nse')
     self._url = EntryCustom(parent, state=tk.NORMAL, width=50)
     self._url.grid(padx=(0, 7), pady=6, row=1, column=1, sticky='nsew')
     return self._protocol  # initial focus
Ejemplo n.º 3
0
 def body(self, parent,options):
     ttk.Label(parent,
               text="Package:",
               borderwidth=0,
               anchor=tk.E).grid(padx=7,pady=6,row=0,sticky='nse')
     self._package = EntryCustom(parent,state=tk.NORMAL)
     self._package.grid(padx=(0,7),pady=6,row=0, column=1,sticky='nsw')
     return self._package # initial focus
Ejemplo n.º 4
0
    def __init__(self, parent, **options):
        super(CredentialsView, self).__init__(parent, **options)

        self.pack(fill=tk.BOTH, expand=tk.TRUE)

        preferences = Preferences()
        self._credentials_preferences = preferences.credentials_preferences

        ttk.Label(self, text="URL:", borderwidth=0,
                  anchor=tk.E).grid(row=0, column=0, pady=5, sticky='nsew')
        urls = [
            credentials.url for credentials in
            self._credentials_preferences.get_all_credentials()
        ]
        self._urlCombobox = URLCombobox(self,
                                        self,
                                        width=80,
                                        exportselection=0,
                                        state='readonly',
                                        values=urls)
        self._urlCombobox._text = self._credentials_preferences.get_url('')
        self._urlCombobox.set(self._urlCombobox._text)
        if len(urls) > 0:
            if self._urlCombobox.get() in urls:
                self._urlCombobox.current(urls.index(self._urlCombobox.get()))
            else:
                self._urlCombobox.current(0)

        self._urlCombobox.grid(row=0, column=1, pady=5, sticky='nsew')

        button_container = tk.Frame(self)
        button_container.grid(row=0, column=2, pady=5, sticky='nsw')
        self._add_button = ttk.Button(button_container,
                                      text='Add',
                                      state='enable',
                                      command=self.onadd)
        self._remove_button = ttk.Button(button_container,
                                         text='Remove',
                                         state='enable',
                                         command=self.onremove)
        self._add_button.pack(side=tk.LEFT)
        if len(urls) > 0:
            self._remove_button.pack(side=tk.LEFT)

        self._apiToken = tk.StringVar()
        self._apiToken.set(self._credentials_preferences.get_token(''))
        ttk.Label(self, text="Token:", borderwidth=0,
                  anchor=tk.E).grid(row=1, column=0, pady=5, sticky='nsew')
        self._apiTokenEntry = EntryCustom(
            self,
            textvariable=self._apiToken,
            width=120,
            state=tk.NORMAL if len(urls) > 0 else tk.DISABLED)
        self._apiTokenEntry.grid(row=1,
                                 column=1,
                                 columnspan=2,
                                 pady=5,
                                 sticky='nsew')

        ttk.Label(self, text="Proxies:", borderwidth=0,
                  anchor=tk.E).grid(row=2, column=0, pady=5, sticky='nsew')
        self._proxiespage = ProxiesPage(self, self._credentials_preferences)
        self._proxiespage.grid(row=3,
                               column=0,
                               columnspan=3,
                               pady=5,
                               sticky='nsew')
        self._proxiespage.show_add_button(True)
        self._proxiespage.show_remove_button(self._proxiespage.has_selection())
        self._proxiespage.show_defaults_button(False)
        if len(urls) == 0:
            self._proxiespage.enable(False)

        self.initial_focus = self._urlCombobox
Ejemplo n.º 5
0
    def __init__(self, parent, preferences, **options):
        super(MainPage, self).__init__(parent, **options)
        self._label_text = None
        self._label = None
        self._apiTokenEntry = None
        self._apiToken = tk.StringVar()
        self._urlEntry = None
        self._url = tk.StringVar()
        self._hubEntry = None
        self._hub = tk.StringVar()
        self._groupEntry = None
        self._group = tk.StringVar()
        self._projectEntry = None
        self._project = tk.StringVar()
        self._verifyEntry = None

        self.pack(fill=tk.BOTH, expand=tk.TRUE)

        self._apiToken.set(preferences.get_token(''))
        self._url.set(preferences.get_url(Preferences.URL))
        self._hub.set(preferences.get_hub(''))
        self._group.set(preferences.get_group(''))
        self._project.set(preferences.get_project(''))
        self._verify = preferences.get_verify(Preferences.VERIFY)

        ttk.Label(self, text="Token:", borderwidth=0,
                  anchor=tk.E).grid(row=0, column=0, sticky='nsew')
        self._apiTokenEntry = EntryCustom(self,
                                          textvariable=self._apiToken,
                                          width=120,
                                          state=tk.NORMAL)
        self._apiTokenEntry.grid(row=0, column=1, sticky='nsew')
        ttk.Label(self, text="URL:", borderwidth=0,
                  anchor=tk.E).grid(row=1, column=0, sticky='nsew')
        self._urlEntry = EntryCustom(self,
                                     textvariable=self._url,
                                     width=60,
                                     state=tk.NORMAL)
        self._urlEntry.grid(row=1, column=1, sticky='nsw')
        ttk.Label(self, text="Hub:", borderwidth=0,
                  anchor=tk.E).grid(row=2, column=0, sticky='nsew')
        self._hubEntry = EntryCustom(self,
                                     textvariable=self._hub,
                                     state=tk.NORMAL)
        self._hubEntry.grid(row=2, column=1, sticky='nsw')
        ttk.Label(self, text="Group:", borderwidth=0,
                  anchor=tk.E).grid(row=3, column=0, sticky='nsew')
        self._groupEntry = EntryCustom(self,
                                       textvariable=self._group,
                                       state=tk.NORMAL)
        self._groupEntry.grid(row=3, column=1, sticky='nsw')
        ttk.Label(self, text="Project:", borderwidth=0,
                  anchor=tk.E).grid(row=4, column=0, sticky='nsew')
        self._projectEntry = EntryCustom(self,
                                         textvariable=self._project,
                                         state=tk.NORMAL)
        self._projectEntry.grid(row=4, column=1, sticky='nsw')
        ttk.Label(self, text="Verify:", borderwidth=0,
                  anchor=tk.E).grid(row=5, column=0, sticky='nsew')
        values = ['True', 'False']
        self._verifyEntry = ttk.Combobox(self,
                                         exportselection=0,
                                         state='readonly',
                                         values=values,
                                         width=6)
        self._verifyEntry.current(values.index(str(self._verify)))
        self._verifyEntry.grid(row=5, column=1, sticky='nsw')

        self.initial_focus = self._apiTokenEntry