Ejemplo n.º 1
0
 def on_btnAddSpeaker_mouseClick(self, event):
     result = dialog.textEntryDialog(self, 'Speaker:', 'Add Speaker', 'First Last')
     if result.accepted:
         text = result.text
         #self.components.lstDelegates.append(text)
         self.delegates.add(text.strip())
         self.update()
Ejemplo n.º 2
0
 def on_appendButton_mouseClick(self, event):#loading the away team roster 
     if self.opponentIDX == -1:
         result = dialog.textEntryDialog(self, 
                                 'Enter Away Team Name',
                                 'Away Team', 
                                 'Team Name')
         if result.returnedString == "Cancel":
             return
         self.opponent = result.text
         self.components.awayLabel.text = self.opponent
         self.opponentIDX += 1
         self.on_appendButton_mouseClick(event)
     
     elif self.opponentIDX == 0:
         choice = dialog.singleChoiceDialog(self,
                                                "How would you like to load the away team roster?",
                                                "Load Away Roster",
                                                ['Load CSV', 'Manually'])
         if choice.selection == 'Manually':
             self.awayManually()
             self.opponentIDX = 1
         elif choice.selection == 'Load CSV':
             self.awayCSV()
             self.opponentIDX = 0
         
     elif self.opponentIDX > 0:
         self.awayManually()
Ejemplo n.º 3
0
 def on_btnToolTip_mouseClick(self, event):
     result = dialog.textEntryDialog(self, 'Enter a toolTip:', 'ToolTip', 'Hello toolTip')
     if result.accepted:
         txt = result.text
         for w in self.components.itervalues():
             if w.__class__.__name__.startswith(w.name[3:]):
                 w.toolTip = txt
Ejemplo n.º 4
0
 def on_addfield_command(self, event):
     '''
         Add a field
     '''
     result = dialog.textEntryDialog(self, 'Name of new field', 'New field',
                                     'new field')
     if result.accepted:
         field_name = result.text
         fields = self.cfg.get('fields')
         fields_l = [fields[k][0] for k in sorted(fields.keys())]
         if not field_name in fields_l:
             keys = [int(x) for x in fields.keys()]
             if keys:
                 ix = 1 + max(keys)
             else:
                 ix = 1
             new_key = unicode(ix)
             if 1:
                 #a new field has empty options list
                 fields[new_key] = [field_name, []]
             else:
                 #or a new field has a predefined list
                 fields[new_key] = [field_name, ['opt 1', 'opt 2', 'opt 3']]
             self.rename_ix_fields()
             self.populate_table()
         else:
             dialog.messageDialog(self, 'Field already exists.', 'Error',
                                  wx.ICON_ERROR | wx.OK)
Ejemplo n.º 5
0
 def on_loadButton_mouseClick(self, event):#loading the home team roster
 #CSV format: first column is list column headings (copy headings from button names) separated by commas
 #Next columns: PlayerName,PlayerNumber,0,0,0,0,0,0,0,No,0
     if self.homeIDX == -1:
         result = dialog.textEntryDialog(self, 
                                 'Enter Home Team Name',
                                 'Home Team', 
                                 'Team Name')
         if result.returnedString == "Cancel":
             return
         self.home = result.text
         self.components.homeLabel.text = self.home
         self.homeIDX += 1
         self.on_loadButton_mouseClick(event)
     
     elif self.homeIDX == 0:
         choice = dialog.singleChoiceDialog(self,
                                                "How would you like to load the home team roster?",
                                                "Load Home Roster",
                                                ['Load CSV', 'Manually'])
         if choice.selection == 'Manually':
             self.homeManually()
             self.homeIDX = 1
         elif choice.selection == 'Load CSV':
             self.homeCSV()
             self.homeIDX = 0
         
     elif self.homeIDX > 0:
         self.homeManually()
Ejemplo n.º 6
0
 def on_gameClock_mouseDoubleClick(self, event):#allows user to change the game clock time
     result = dialog.textEntryDialog(self, 
                                 'Enter Clock Time',
                                 'Time', 
                                 self.components.gameClock.text)
     self.minutes = int(result.text[0:result.text.index(':')])
     self.seconds = int(result.text[result.text.index(':')+1:len(result.text)])
     self.components.gameClock.text = str("%02d" % (self.minutes,))+':'+str("%02d" % (self.seconds,))
Ejemplo n.º 7
0
 def on_menuImageScaleSize_select(self, event):
     result = dialog.textEntryDialog(self, "Scale by percent:",
                                     "Scale image", "")
     if result.accepted:
         try:
             scale = float(result.text) / 100.0
             self.displayFileScaled(scale, scale)
         except ValueError:
             pass
Ejemplo n.º 8
0
 def on_btnGuessWord_mouseClick(self, event):
     result = dialog.textEntryDialog(self,
      'What is the word','Hangman','the word')
     self.components.stYourGuesses.text = \
         self.components.stYourGuesses.text + "  " + result.text + " "
     if (result.text).strip() == (self.currentword).strip():
         dialog.alertDialog(self, 'You did it!', 'Hangman')
         self.new_game()
     else:
         self.wrong_guess()
Ejemplo n.º 9
0
 def on_btnGuessWord_mouseClick(self, event):
     result = dialog.textEntryDialog(self, 'What is the word', 'Hangman',
                                     'the word')
     self.components.stYourGuesses.text = \
         self.components.stYourGuesses.text + "  " + result.text + " "
     if (result.text).strip() == (self.currentword).strip():
         dialog.alertDialog(self, 'You did it!', 'Hangman')
         self.new_game()
     else:
         self.wrong_guess()
Ejemplo n.º 10
0
 def on_doEditGoTo_command(self, event):
     result = dialog.textEntryDialog(self,
                                     self.resource.strings.gotoLineNumber,
                                     self.resource.strings.gotoLine, '')
     # this version doesn't alert the user if the line number is out-of-range
     # it just fails quietly
     if result.accepted:
         try:
             self.gotoLine(int(result.text))
         except:
             pass
Ejemplo n.º 11
0
 def on_menuSlideshowSetInterval_select(self, event):
     interval = str(self.interval / 1000)
     result = dialog.textEntryDialog(
         self, "Time interval between slides (seconds):", "Slide interval",
         interval)
     if result.accepted:
         try:
             interval = int(result.text) * 1000
             self.interval = interval
         except ValueError:
             pass
Ejemplo n.º 12
0
	def __login_process( self ):
		result = dialog.textEntryDialog( self, Const[ "PLZ_ENTER_LOGIN_CODE" ], Const[ "READY_TO_LOGIN" ] )
		if not result.accepted:
			return False
		
		code = result.text
		
		if code not in DB_LOGIN_ACC:
			return False, False
		
		return True, DB_LOGIN_ACC[ code ]
Ejemplo n.º 13
0
 def on_buttonTextEntry_mouseClick(self, event):
     result = dialog.textEntryDialog(self,
                                     'What is your favorite language?',
                                     'A window title', 'Python')
     """
     result = dialog.textEntryDialog(self, 
                                 'What is your favorite language?',
                                 'A window title', 
                                 'Python', wx.TE_MULTILINE)
     """
     self.components.fldResults.text = "textEntryDialog result:\naccepted: %s\nreturnedString: %s\ntext: %s" % (
         result.accepted, result.returnedString, result.text)
Ejemplo n.º 14
0
 def on_goToRecord_command(self, event):
     result = dialog.textEntryDialog(self, 'Go to card number:',
                                     'Go to Card', '')
     # this version doesn't alert the user if the line number is out-of-range
     # it just fails quietly
     if result.accepted:
         try:
             i = int(result.text)
             if i > 0:
                 self.document.goRecord(i - 1)
         except:
             pass
Ejemplo n.º 15
0
    def on_doAutomata_command(self, event):
        automata = event.target.name

        if automata == 'menuAutomataLife':
            result = dialog.textEntryDialog(self,
                                            'Steps (-1 means continuous):',
                                            'Number of steps', '-1')
            if result.accepted:
                steps = int(result.text)
                self.keepDrawing = True
                startTime = util.time()
                self.doRunLife(steps)
                print "Draw time: %f" % (util.time() - startTime)
Ejemplo n.º 16
0
 def homeManually(self):#loading home roster by inserting text. Called in on_loadButton_mouseClicked function
     result = dialog.textEntryDialog(self, 
                                     'Add a player to the home team roster',
                                     'Add Player', 
                                     'Player Name')
     if result.returnedString == "Cancel":
         return
     addedPlayer = result.text
     self.homeRoster.append(addedPlayer)
     self.homeTimes.append(0)
     if result.returnedString == "Ok":
         numResult = dialog.textEntryDialog(self, 
                                 "Enter the Player's number",
                                 'A window title', 
                                 'Player Number')
     if numResult.returnedString == "Cancel":
         numResult.text = "##"
     print numResult.returnedString
     print numResult.text
     self.homeRosterNum.append(numResult.text)
     self.components.theList.columnHeadings = ['Player','Number','Goals','Assists','Shots','Groundballs','FOW','FOL','Saves','Playing','Minutes']
     for i in range(0,len(self.homeRoster)):
         self.components.theList.Append([[self.homeRoster[i],self.homeRosterNum[i],str(0),str(0),str(0),str(0),str(0),str(0),str(0),'No',str(0)]])
Ejemplo n.º 17
0
	def __connection_process( self ):
		result = dialog.textEntryDialog( self, Const[ "PLZ_ENTER_AUCTION_IP" ], Const[ "READY_TO_CONNECT" ], self.__load_cached_ip() )
		if not result.accepted:
			return False
		
		connect_ip = result.text
		self.__save_cached_ip( connect_ip )
		
		try:
			self.__mongo_client = pymongo.MongoClient( connect_ip, DB_CFG_PORT )
		except:
			self.__add_msg( Const[ "ERRMSG_DB_CNCT_FAIL" ] % ( connect_ip, DB_CFG_PORT ), True )
			return False
			
		return connect_ip
Ejemplo n.º 18
0
 def on_menuSlideshowGotoSlide_select(self, event):
     if self.fileList is not None and self.fileList != []:
         result = dialog.textEntryDialog(self, "Slide number:",
                                         "Goto slide",
                                         str(self.fileIndex + 1))
         # this version doesn't alert the user if the line number is out-of-range
         # it just fails quietly
         if result.accepted:
             try:
                 n = int(result.text) - 1
                 if n >= 0 and n < len(self.fileList):
                     self.fileIndex = n
                     self.openFile(self.fileList[self.fileIndex],
                                   self.fileIndex)
             except ValueError:
                 pass
Ejemplo n.º 19
0
 def on_btnGuessLetter_mouseClick(self, event):
     result = dialog.textEntryDialog(self, 'enter the letter here:',
                                     'Hangman', '')
     guess = result.text
     if len(guess) == 1:
         self.components.stYourGuesses.text = \
           self.components.stYourGuesses.text + "  " + guess + " "
         if result.text in self.currentword:
             locations = find_letters(guess, self.currentword)
             self.components.stDisplayWord.text = replace_letters \
               (self.components.stDisplayWord.text, locations, guess)
             if self.components.stDisplayWord.text.find('-') == -1:
                 dialog.alertDialog(self, 'You win!!!!!', 'Hangman')
                 self.new_game()
         else:
             self.wrong_guess()
     else:
         dialog.alertDialog(self, 'Type one letter only', 'Hangman')
Ejemplo n.º 20
0
 def on_btnGuessLetter_mouseClick(self, event):
     result = dialog.textEntryDialog(self, 
       'enter the letter here:', 'Hangman', '')
     guess = result.text
     if len(guess) == 1:
         self.components.stYourGuesses.text = \
           self.components.stYourGuesses.text + "  " + guess + " "
         if result.text in self.currentword:
             locations = find_letters(guess, self.currentword)
             self.components.stDisplayWord.text = replace_letters \
               (self.components.stDisplayWord.text, locations, guess)
             if self.components.stDisplayWord.text.find('-') == -1:
                 dialog.alertDialog(self, 'You win!!!!!', 'Hangman')
                 self.new_game()
         else:
             self.wrong_guess()
     else:
         dialog.alertDialog(self, 'Type one letter only', 'Hangman')
Ejemplo n.º 21
0
 def on_fieldslist_mouseDoubleClick(self, event):
     '''
         Change pick list for a field
     '''
     ix = self.components.fieldslist.selection
     fields = self.cfg.get('fields')
     fields_l = [fields[k][0] for k in sorted(fields.keys())]
     key = sorted(fields.keys())[ix]
     fieldname, options = fields[key]
     result = dialog.textEntryDialog(
         self, 'Edit pick list for\n\n{}'.format(fieldname), 'Edit field',
         '{}'.format(options))
     if result.accepted:
         try:
             value = [unicode(x) for x in eval(result.text)]
             fields[key][1] = value
         except:
             dialog.messageDialog(self, 'Invalid list.', 'Error',
                                  wx.ICON_ERROR | wx.OK)
Ejemplo n.º 22
0
 def on_otherList_itemActivated(self, event):
     #When an entry is double clicked
     base = self.components
     rows = base.otherList.getStringSelection()
     if len(rows) == 0:
         return
     if not isinstance(rows[0], StringTypes):
         rows = [','.join(x) for x in rows]
     text = '\n'.join(rows)
     dlg = dialog.textEntryDialog(self, 
                                 'Edit Player Data',
                                 'Edit Data', 
                                 text)
     edit = ''
     edit = dlg.text
     edit = edit.split(',')
     tempVar = self.components.otherList.items
     for i in range(0,len(self.components.otherList.columnHeadings)):
         tempVar[tempNumber][i] = edit[i]
     self.components.otherList.items = tempVar
Ejemplo n.º 23
0
    def bloggerLogin(self):
        """Logs in to a blogger server.

        Returns 1 on success, 0 on failure."""
        # check the settings have been entered.
        if (not self.checkSetupOK(1)):
            return 0

        if self.getPassword() == "":
            result = dialog.textEntryDialog(None, \
                                         'Please enter your Blogger password (It will not be saved to the config): ',                                                              
                                         "Password entry...",
                                         '', wx.TE_PASSWORD)
            if not result.accepted:
                self.setErrorMessage("You must enter a password to continue.")
                return 0
            self.sessionPassword = result.text

        if not self.getLoggedIn():
            #if self.useProxy == "yes":
            #    print "created with proxy"
            #    self.bloggerSite = xmlrpclib.Server(self.prefs["rpcserver"], transport=UrllibTransport())
            #else:
            #    print "created without proxy"
            self.createBloggerSite()

            try:
                self.blogs = self.bloggerSite.blogger.getUsersBlogs(self.settings["appkey"], \
                                                                    self.prefs["username"], \
                                                                    self.getPassword())
                #print self.blogs
                if len(self.blogs) > 0 and self.prefs["activeBlog"] == -1:
                    self.prefs["activeBlog"] = 0
            except xmlrpclib.Fault, e:
                self.setErrorMessage("Error logging in: %s" % e.faultString)
                return 0
            
            self.setLoggedIn(1)