Example #1
0
    def __init__(self, action, **kwargs):
        title = 'Password'

        self._action = action

        lbl_text = action.get_pass_desc()

        ModalDialog.__init__(self, title=title)

        label = Label(lbl_text)
        self.txt_passwd = TextField(multiline=False, password=True)

        self.ok_button = Button("Connect",
                                action="ok",
                                enabled=True,
                                style='default')
        self.cancel_button = Button("Cancel",
                                    enabled=True,
                                    style='cancel',
                                    action='cancel')

        self.place(label, left=padding, top=padding)
        self.place(self.txt_passwd,
                   left=padding,
                   top=label + padding,
                   right=label.right if label.right > 260 else 260)

        self.place(self.cancel_button,
                   top=self.txt_passwd + padding,
                   right=self.txt_passwd.right)
        self.place(self.ok_button,
                   top=self.txt_passwd + padding,
                   right=self.cancel_button - padding)
        self.shrink_wrap(padding=(padding, padding))
   def __init__(self):
      """This method is the constructor for a new credentials dialog."""
      ModalDialog.__init__(self)

      #default the credentials information
      self._user = None
      self._password = None

      label = Label("Please enter your credentials.")
      self._ok_button = Button("OK", action = "ok", style = "default")
      self._cancel_button = Button("Cancel", style = "cancel", action = "cancel")
      self._user_box = TextField(width = 150)
      self._password_box = TextField(width = 150,
                                     password = "******",
                                     select_action = "password_click")
      self.place(label, left = 20, top = 20)
      self.place(self._user_box, top = label + 10, right = label.right)
      self.place(self._password_box,
                 top = self._user_box.bottom + 10,
                 right = label.right)
      self.place(self._ok_button,
                 top = self._password_box.bottom + 20,
                 right = label.right)
      self.place(self._cancel_button,
                 top = self._ok_button.top,
                 right = self._ok_button.left - 20)
      self.shrink_wrap(padding = (20, 20))

      self._message_label = None

      #the parent class will use this function to set the title
      self.set_title( "Google Credentials" )
      self._password_box.width = 150
      self._Set_Text()
      self._user_canceled = False
Example #3
0
 def __init__(self, text, timeout):
     ModalDialog.__init__(self)
     label = Label(text)
     self.ok_button = Button("OK", action = "ok", enabled = False)
     self.place(label, left = 20, top = 20)
     self.place(self.ok_button, top = label + 20, right = label.right)
     self.shrink_wrap(padding = (20, 20))
     self.timer = Task(self.enable_button, timeout)
Example #4
0
 def __init__(self, text, timeout):
     ModalDialog.__init__(self)
     label = Label(text)
     self.ok_button = Button("OK", action="ok", enabled=False)
     self.place(label, left=20, top=20)
     self.place(self.ok_button, top=label + 20, right=label.right)
     self.shrink_wrap(padding=(20, 20))
     self.timer = Task(self.enable_button, timeout)
 def __init__(self, kind, prompt, width = None, lines = None,
         button_labels = None, default = None, cancel = None):
     #if width is None:
     #	width = self._default_width
     #if lines is None:
     #	lines = self._default_lines
     ModalDialog.__init__(self, style = 'alert')
     self.label = Label(text = self._wrap(prompt), lines = lines)
     if self.label.width < self._minimum_width:
         self.label.width = self._minimum_width
     self._create_buttons(*button_labels)
     #self.default_button = self._find_button(default)
     #self.cancel_button = self._find_button(cancel)
     self._layout(kind)
Example #6
0
    def __init__(self, session, transport,  **kwargs):
        title = 'Login'

        self._session = session
        self._transport = transport

        if 'title' in kwargs:
            title = kwargs['title']

        ModalDialog.__init__(self, title=title)

        label = Label('Key File:')
        btn_rsa = RadioButton(title='RSA', value = 'RSA')
        btn_dss = RadioButton(title='DSS', value = 'DSS')
        self.key_file_group = key_file_group = RadioGroup(items = [btn_rsa, btn_dss])
        key_file_group.value = 'RSA'
        self.txt_key_file = txt_key_file = TextField(multiline = False, password = False)
        btn_browse_file = Button('Browse', action='choose_key_file', enabled = True)

        lbl_login = Label('Login')
        self.txt_login = TextField(multiline = False, password = False)

        if 'username' in kwargs:
            self.txt_login.text = kwargs['username']

        lbl_passwd = Label('Password')
        self.txt_passwd = TextField(multiline = False, password = True)

        self.ok_button = Button("Connect", action = "ok", enabled = True, style = 'default')
        self.cancel_button = Button("Cancel", enabled = True, style = 'cancel', action='cancel')

        self.place(label, left = padding, top = padding)
        self.place(btn_rsa, left = label + padding, top = padding)
        self.place(btn_dss, left = btn_rsa + padding, top = padding)
        self.place(txt_key_file, left = padding, top = btn_rsa + padding, right = 240)
        self.place(btn_browse_file, left = txt_key_file, top = txt_key_file.top)

        self.place(lbl_login, left = padding, top = txt_key_file + padding)
        self.place(self.txt_login, left = padding, top = lbl_login + padding, right = btn_browse_file.right)

        self.place(lbl_passwd, left = padding, top = self.txt_login + padding)
        self.place(self.txt_passwd, left = padding, top = lbl_passwd + padding, right = btn_browse_file.right)

        self.place(self.cancel_button, top = self.txt_passwd + padding, right = btn_browse_file.right)
        self.place(self.ok_button, top = self.txt_passwd + padding, right = self.cancel_button - padding)
        self.shrink_wrap(padding = (padding, padding))
Example #7
0
 def __init__(self,
              kind,
              prompt,
              width=None,
              lines=None,
              button_labels=None,
              default=None,
              cancel=None):
     #if width is None:
     #	width = self._default_width
     #if lines is None:
     #	lines = self._default_lines
     ModalDialog.__init__(self, style='alert')
     self.label = Label(text=self._wrap(prompt), lines=lines)
     if self.label.width < self._minimum_width:
         self.label.width = self._minimum_width
     self._create_buttons(*button_labels)
     #self.default_button = self._find_button(default)
     #self.cancel_button = self._find_button(cancel)
     self._layout(kind)
Example #8
0
    def __init__(self, session, l_f, r_f, r_home, r_pwd, is_upload, **kwargs):
        title = 'File Transfer'

        self._session = session
        self._l_f = l_f
        self._r_f = r_f
        self._r_home = r_home
        self._r_pwd = r_pwd

        if 'title' in kwargs:
            title = kwargs['title']

        ModalDialog.__init__(self, title=title)
        FileTransfer.__init__(self, session, False)

        label_local = Label('Local File:')
        label_local_name = Label(l_f)

        label_remote = Label('Remote File:')
        label_remote_name = Label(r_f)

        self.cancel_button = Button("Close", enabled = True, style = 'cancel', action='cancel')

        self.label_progress = label_progress = Label('Progress: 0%')

        self.place(label_local, left = padding, top = padding)
        self.place(label_local_name, left = padding, top = label_local + padding, right = 240)

        self.place(label_remote, left = padding, top = label_local_name + padding)
        self.place(label_remote_name, left = padding, top = label_remote + padding, right = 240)

        self.place(label_progress, left = padding, top = label_remote_name + padding, right = label_remote_name.right)

        self.place(self.cancel_button, top = self.label_progress + padding, right = label_remote_name.right)
        self.shrink_wrap(padding = (padding, padding))

        if is_upload:
            self.task = Task(self.upload, .01)
        else:
            self.task = Task(self.download, .01)
Example #9
0
    def __init__(self, action, **kwargs):
        title = 'Password'

        self._action = action

        lbl_text = action.get_pass_desc()

        ModalDialog.__init__(self, title=title)

        label = Label(lbl_text)
        self.txt_passwd = TextField(multiline = False, password = True)

        self.ok_button = Button("Connect", action = "ok", enabled = True, style = 'default')
        self.cancel_button = Button("Cancel", enabled = True, style = 'cancel', action='cancel')

        self.place(label, left = padding, top = padding)
        self.place(self.txt_passwd, left = padding, top = label + padding,
                   right= label.right if label.right > 260 else 260)

        self.place(self.cancel_button, top = self.txt_passwd + padding, right = self.txt_passwd.right)
        self.place(self.ok_button, top = self.txt_passwd + padding, right = self.cancel_button - padding)
        self.shrink_wrap(padding = (padding, padding))
Example #10
0
    def __init__(self, session,  **kwargs):
        title = 'File Transfer'

        self._session = session

        if 'title' in kwargs:
            title = kwargs['title']

        ModalDialog.__init__(self, title=title)
        FileTransfer.__init__(self, session)

        label_local = Label('Local File:')
        self.txt_local_file = txt_local_file = TextField(multiline = False, password = False)
        btn_browse_file = Button('Browse', action='choose_local_file', enabled = True)

        label_remote = Label('Remote File:')
        self.txt_remote_file = txt_remote_file = TextField(multiline = False, password = False)

        self.download_button = Button("Download", action = "download", enabled = True)
        self.upload_button = Button("Upload", action = "upload", enabled = True)
        self.cancel_button = Button("Close", enabled = True, style = 'cancel', action='cancel')

        self.label_progress = label_progress = Label('Progress: 0%')

        self.place(label_local, left = padding, top = padding)
        self.place(txt_local_file, left = padding, top = label_local + padding, right = 240)
        self.place(btn_browse_file, left = txt_local_file, top = txt_local_file.top)

        self.place(label_remote, left = padding, top = txt_local_file + padding)
        self.place(txt_remote_file, left = padding, top = label_remote + padding, right = 240)

        self.place(label_progress, left = padding, top = txt_remote_file + padding, right = btn_browse_file.right)

        self.place(self.cancel_button, top = self.label_progress + padding, right = btn_browse_file.right)
        self.place(self.download_button, top = self.cancel_button.top, right = self.cancel_button - padding)
        self.place(self.upload_button, top = self.cancel_button.top, right = self.download_button - padding)
        self.shrink_wrap(padding = (padding, padding))
Example #11
0
    def __init__(self, session, transport, **kwargs):
        title = 'Login'

        self._session = session
        self._transport = transport

        if 'title' in kwargs:
            title = kwargs['title']

        ModalDialog.__init__(self, title=title)

        label = Label('Key File:')
        btn_rsa = RadioButton(title='RSA', value='RSA')
        btn_dss = RadioButton(title='DSS', value='DSS')
        self.key_file_group = key_file_group = RadioGroup(
            items=[btn_rsa, btn_dss])
        key_file_group.value = 'RSA'
        self.txt_key_file = txt_key_file = TextField(multiline=False,
                                                     password=False)
        btn_browse_file = Button('Browse',
                                 action='choose_key_file',
                                 enabled=True)

        lbl_login = Label('Login')
        self.txt_login = TextField(multiline=False, password=False)

        if 'username' in kwargs:
            self.txt_login.text = kwargs['username']

        lbl_passwd = Label('Password')
        self.txt_passwd = TextField(multiline=False, password=True)

        self.ok_button = Button("Connect",
                                action="ok",
                                enabled=True,
                                style='default')
        self.cancel_button = Button("Cancel",
                                    enabled=True,
                                    style='cancel',
                                    action='cancel')

        self.place(label, left=padding, top=padding)
        self.place(btn_rsa, left=label + padding, top=padding)
        self.place(btn_dss, left=btn_rsa + padding, top=padding)
        self.place(txt_key_file,
                   left=padding,
                   top=btn_rsa + padding,
                   right=240)
        self.place(btn_browse_file, left=txt_key_file, top=txt_key_file.top)

        self.place(lbl_login, left=padding, top=txt_key_file + padding)
        self.place(self.txt_login,
                   left=padding,
                   top=lbl_login + padding,
                   right=btn_browse_file.right)

        self.place(lbl_passwd, left=padding, top=self.txt_login + padding)
        self.place(self.txt_passwd,
                   left=padding,
                   top=lbl_passwd + padding,
                   right=btn_browse_file.right)

        self.place(self.cancel_button,
                   top=self.txt_passwd + padding,
                   right=btn_browse_file.right)
        self.place(self.ok_button,
                   top=self.txt_passwd + padding,
                   right=self.cancel_button - padding)
        self.shrink_wrap(padding=(padding, padding))
Example #12
0
 def __init__(self):
   ModalDialog.__init__(self, resizable=True)
   self.persons_tbl = Table(columns=[Column('fullName', lambda p: p.fullName)],
                            scrolling='v',
                            selection_changed_action=self.person_picked)
   self.place(self.persons_tbl, left=0, right=0, top=0, bottom=0, sticky='nesw')