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 #2
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 #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))
   def Add_Player( self,
                   player_to_add ):
      """This function will add the player to the current team."""
      
      if self._current_manager <> None:
         
         if self._Ask_User( "Are you sure that you want to\n add " + \
                            player_to_add.Get_Name( ) + \
                            "?" ):
         
            # Change the local data
            self._current_manager.Add_Player( player_to_add )
         
            #tell the player their new manager
            player_to_add.Set_Manager_Name( \
               self._current_manager.Get_Email( ) )
            try:
               #update the database
               self._parser.Set_Player_Line(player_to_add.Get_Raw_Data())

               #change the player information with the username
               #string instead of the whole email address
               player_to_add.Set_Manager_Name( \
                  string_definitions.Extract_Username( \
                     self._current_manager.Get_Email( ) ) )
            
               #update the GUI
               self.Show_Team( self._current_manager.Get_Username( ) )
            #end try
            except gdata.service.RequestError:
               #create a modal dialog to show
               error_dialog = ModalDialog(title = "Couldn't Add Player", 
                                          size = (400, 70))
               
               #create an information label
               error_dialog.place(Label(text = "Player has already " + \
                                               "been added by someone else"), 
                                  left = 20, 
                                  top = 20)
                                  
               #create the button
               error_dialog.default_button = DefaultButton()
               
               error_dialog.place(error_dialog.default_button, 
                                  right = -20, 
                                  bottom = -20)
   
               #start the reload of the players
               self.Load_Player_Data( )
   
               #show the dialog
               error_dialog.present()
               
               #re-show the player data
               self.Show_Players()
Example #8
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 #9
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)
   def Drop_Player( self,
                    player ):
      """This function will add the player to the current team."""

      confirm = self._Ask_User( "Are you sure that you want to \ndrop " + \
                                player.Get_Name( ) + \
                                "?" )
      #if the user was sure
      if confirm:

            
            # Change the local data
            self._current_manager.Drop_Player( player )
         
            #tell the player they no longer have a mananger
            player.Set_Manager_Name( "" )
            try:
               #update the database
               self._parser.Set_Player_Line(player.Get_Raw_Data())

               #update the GUI
               self.Show_Team( self._current_manager.Get_Username( ) )
            #end try
            except gdata.service.RequestError:
               #create a modal dialog to show
               error_dialog = ModalDialog(title = "Couldn't Drop Player", 
                                          size = (400, 70))
               
               #create an information label
               error_dialog.place(Label(text = "Error when trying to drop " + \
                                        "player." ), 
                                  left = 20, 
                                  top = 20)
                                  
               #create the button
               error_dialog.default_button = DefaultButton()
               
               error_dialog.place(error_dialog.default_button, 
                                  right = -20, 
                                  bottom = -20)
   
               #start the reload of the players
               self.Load_Player_Data( )
   
               #show the dialog
               error_dialog.present()
               
               #re-show the player data
               self.Show_Players()
Example #11
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 #12
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 #13
0
	def make_login_window(self, main_win):
		log_win = ModalDialog(title='Nueva sesiĆ³n de usuario detectada',\
			size=(500,500))
		load_login_elements(log_win)
		log_win.center()
		result = log_win.present()
		if not result:
			self._quit()
		else:
			if not attempt_set_new_master():
				print('No new master could be created')
			else:
				print('New master set. ALL GLORY TO HIM!!')
				main_win.show()
		log_win.destroy()
def modal_dialog():
    #global dlog ###
    dlog = ModalDialog(title = "Spanish Inquisition", size = (200, 140))
    dlog.place(Label(text = "Surprise!!!"), left = 20, top = 20)
    field = TextField()
    dlog.place(field, left = 20, top = 60, right = -20)
    field.become_target()
    dlog.default_button = DefaultButton()
    dlog.cancel_button = CancelButton()
    dlog.place(dlog.default_button, right = -20, bottom = -20)
    dlog.place(dlog.cancel_button, left = 20, bottom = -20)
    dlog.center()
    result = dlog.present()
    say("Result =", result)
    dlog.destroy()
Example #15
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')
Example #16
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 #17
0
def modal_dialog():
    #global dlog ###
    dlog = ModalDialog(title="Spanish Inquisition", size=(200, 140))
    dlog.place(Label(text="Surprise!!!"), left=20, top=20)
    field = TextField()
    dlog.place(field, left=20, top=60, right=-20)
    field.become_target()
    dlog.default_button = DefaultButton()
    dlog.cancel_button = CancelButton()
    dlog.place(dlog.default_button, right=-20, bottom=-20)
    dlog.place(dlog.cancel_button, left=20, bottom=-20)
    dlog.center()
    result = dlog.present()
    say("Result =", result)
    dlog.destroy()
   def _Ask_User( self,
                  question ):
      """This method will ask the user if they're sure that they
      want to do what they've said they do. Basically, we're protecting
      them from themselves."""

      
      #create the confirm dialog
      confirm_dialog = ModalDialog( title = "Please Confirm" )
      
      confirm_dialog.place( Label(text = question ), 
                            left = 20, 
                            top = 20 )

      #create the buttons for OK/Cancel
      confirm_dialog.default_button = DefaultButton()
      confirm_dialog.cancel_button = CancelButton()

      #put the buttons on the GUI
      confirm_dialog.place( confirm_dialog.default_button, 
                            right = -20, 
                            bottom = -20 )
      confirm_dialog.place( confirm_dialog.cancel_button, 
                            left = 20, 
                            bottom = -20 )

      #center the dialog
      confirm_dialog.center( )
      
      #ask for confirmation to make sure that the user really wants to do
      #this
      confirm = confirm_dialog.present( )      
      
      return confirm