def initializeParameters(self): with open('./.pathToAP', 'r') as textFile: self.pathToAP = textFile.readline() sys.path.append(self.pathToAP) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=') + 1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=') + 1:]) self.mouseCursor = PyMouse() if self.control != 'tracker': self.mousePosition = self.winWidth - 8 - self.xBorder, self.winHeight - 48 - self.yBorder self.mouseCursor.move(*self.mousePosition) mixer.init() if self.pressSound.lower() != 'off': self.pressingSound = mixer.Sound(self.pathToAP + '/sounds/pressSound.ogg')
def initializeParameters(self): textFile = codecs.open("./.pathToAP", mode="r", encoding="utf-8") self.pathToAP = textFile.readline() textFile.close() sys.path.append(self.pathToAP) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=') + 1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=') + 1:]) self.flaga = 0 self.checkFlag = False self.flag = 'row' self.columnIteration = 0 self.rowIteration = 0 self.maxRowIteration = 2 * 5 self.maxColumnIteration = 2 * 4 self.countRow = 0 self.countColumn = 0 self.pressFlag = True self.PicNr = 0 self.result = 0 self.labels = ['speak', 'literuj', 'undo', 'exit'] self.WordsList = os.listdir(self.pathToAP + 'multimedia/ewriting/pictures') shuffle(self.WordsList) self.poczatek = True self.czyBack = False self.numberOfExtraWords = 3 self.numberOfPresses = 1 if self.control != 'tracker': self.mouseCursor = PyMouse() self.mousePosition = self.winWidth - 8 - self.xBorder, self.winHeight - 8 - self.yBorder self.mouseCursor.move(*self.mousePosition) if self.switchSound.lower() != 'off' or self.pressSound.lower( ) != 'off': mixer.init() self.switchingSound = mixer.Sound(self.pathToAP + '/sounds/switchSound.ogg') self.pressingSound = mixer.Sound(self.pathToAP + '/sounds/pressSound.ogg') self.powrotSound = mixer.Sound(self.pathToAP + '/sounds/powrot.ogg')
def initializeParameters(self): textFile = codecs.open("./.pathToAP", mode="r", encoding="utf-8") self.pathToAP = textFile.readline() textFile.close() # with open( './.pathToAP' ,'r' ) as textFile: # self.pathToAP = textFile.readline( ) sys.path.append(self.pathToAP) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=') + 1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=') + 1:]) self.ownWord = '' self.flaga = 0 self.checkFlag = False self.PicNr = 0 self.result = 0 self.WordsList = os.listdir( unicode(self.pathToAP) + u"multimedia/ewriting/pictures") shuffle(self.WordsList) self.poczatek = True self.czyBack = False self.numberOfPresses = 1 self.pressFlag = False self.numberOfIteration = 0 self.maxNumberOfIteration = 2 * 5 if self.control != 'tracker': self.mouseCursor = PyMouse() self.mousePosition = self.winWidth - 8 - self.xBorder, self.winHeight - 8 - self.yBorder self.mouseCursor.move(*self.mousePosition) if self.switchSound.lower() != 'off' or self.pressSound.lower( ) != 'off': mixer.init() self.switchingSound = mixer.Sound(self.pathToAP + '/sounds/switchSound.ogg') self.pressingSound = mixer.Sound(self.pathToAP + '/sounds/pressSound.ogg') self.powrotSound = mixer.Sound(self.pathToAP + '/sounds/powrot.ogg')
def initializeParameters(self): with open('.pathToAP', 'r') as textFile: self.pathToAP = textFile.readline() sys.path.append(self.pathToAP) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=') + 1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=') + 1:]) self.flag = 'row' self.pressFlag = False self.pressedStopFlag = False self.rowIteration = 0 self.colIteration = 0 self.numberOfColumns = 2, self.numberOfRows = 7, self.numberOfEmptyIteration = 0 self.countRows = 0 self.countColumns = 0 self.countMaxRows = 2 self.countMaxColumns = 2 self.numberOfPresses = 0 self.trackCounter = 0 self.initCount = 0 #it's better to use another timer than conditions self.initCount2 = 0 self.mouseCursor = PyMouse() if self.control != 'tracker': self.mousePosition = self.winWidth - 8 - self.xBorder, self.winHeight - 48 - self.yBorder self.mouseCursor.move(*self.mousePosition) if self.switchSound.lower() == 'on' or self.pressSound.lower() == 'on': mixer.init() if self.switchSound.lower() == 'on': self.switchingSound = mixer.Sound(self.pathToAP + '/sounds/switchSound.ogg') if self.pressSound.lower() == 'on': self.pressingSound = mixer.Sound(self.pathToAP + '/sounds/pressSound.ogg') self.width = self.numberOfColumns[0] * 120 self.height = self.numberOfRows[0] * 100
def initializeParameters(self): with open( './.pathToAP' ,'r' ) as textFile: self.pathToAP = textFile.readline( ) sys.path.append( self.pathToAP ) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=')+1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=')+1:]) self.pressFlag = False self.numberOfColumns = 2, self.numberOfRows = 2, self.columnIteration = 0 self.rowIteration = 0 self.panelIteration = 0 self.emptyColumnIteration = 0 self.emptyRowIteration = 0 self.emptyPanelIteration = 0 self.maxEmptyColumnIteration = 2 self.maxEmptyRowIteration = 2 self.maxEmptyPanelIteration = 2 self.numberOfPresses = 1 if self.control != 'tracker': self.mouseCursor = PyMouse( ) self.mousePosition = self.winWidth - 8 - self.yBorder, self.winHeight - 8 - self.xBorder self.mouseCursor.move( *self.mousePosition ) mixer.init() if self.switchSound.lower( ) != 'off' or self.pressSound.lower( ) != 'off': self.switchingSound = mixer.Sound( self.pathToAP + '/sounds/switchSound.ogg' ) self.pressingSound = mixer.Sound( self.pathToAP + '/sounds/pressSound.ogg' ) self.graSound = mixer.Sound( self.pathToAP + '/sounds/gra.ogg' ) self.oneSound = mixer.Sound( self.pathToAP + '/sounds/rows/1.ogg' ) self.pisanieSound = mixer.Sound( self.pathToAP + '/sounds/pisanie.ogg' ) self.powrotSound = mixer.Sound( self.pathToAP + '/sounds/powrot.ogg' ) self.usypiamSound = mixer.Sound( self.pathToAP + '/sounds/usypiam.ogg' ) self.SetBackgroundColour( 'black' )
def initializeParameters(self): with open('./.pathToAP', 'r') as textFile: self.pathToAP = textFile.readline() sys.path.append(self.pathToAP) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=') + 1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=') + 1:]) self.pressFlag = False self.numberOfRows = 3, self.numberOfColumns = 1, self.numberOfIteration = 0 self.maxNumberOfIteration = 2 * self.numberOfRows[0] self.flaga = 0 if self.control != 'tracker': self.mouseCursor = PyMouse() self.mousePosition = self.winWidth - 8 - self.xBorder, self.winHeight - 8 - self.yBorder self.mouseCursor.move(*self.mousePosition) if self.switchSound.lower() != 'off' or self.pressSound.lower( ) != 'off': mixer.init() self.switchingSound = mixer.Sound(self.pathToAP + '/sounds/switchSound.ogg') self.pressingSound = mixer.Sound(self.pathToAP + '/sounds/pressSound.ogg') self.powrotSound = mixer.Sound(self.pathToAP + '/sounds/powrot.ogg') self.slowoSound = mixer.Sound(self.pathToAP + '/sounds/slowo.ogg') self.dziuraSound = mixer.Sound(self.pathToAP + '/sounds/dziura.ogg') self.poczatek = True self.numberOfPresses = 1
def initializeParameters(self): with open('.pathToAP', 'r') as textFile: self.pathToAP = textFile.readline() sys.path.append(self.pathToAP) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=') + 1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=') + 1:]) self.mouseCursor = PyMouse() self.mousePosition = self.winWidth - 8 - self.xBorder, self.winHeight - 8 - self.yBorder self.mouseCursor.move(*self.mousePosition) self.numberOfPresses = 3
def initializeParameters(self): with open('./.pathToAP', 'r') as textFile: self.pathToAP = textFile.readline() sys.path.append(self.pathToAP) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=') + 1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=') + 1:]) self.colorlegend = { '0': '#E5D9D9', '1': '#5545EA', '2': '#B229B7', '3': '#13CE1A', '4': '#CE1355', '5': '#F9F504', '6': '#FF7504', '7': '#FF0404', '8': '#000000' } self.options = ['mode', 'restart', 'exit'] self.selection_mode = 'mines' self.winstate = False self.failstate = False self.first_move = True self.gamesize = (5, 10) #do ustalania self.numberOfRows = self.gamesize[0] + 1 self.numberOfColumns = self.gamesize[1] self.numberOfMines = 4 if self.numberOfColumns < 3 or self.numberOfColumns * ( self.numberOfRows - 1) < self.numberOfMines: print '\nZbyt mała liczba komórek lub kolumn. \nKomórek musi być więcej niż min, a minimalna liczba kolumn to 3. \n' exit() self.game = minesweeper.Minesweeper_game(self.gamesize, self.numberOfMines) self.labels = self.game.displayfield.flatten() self.flag = 'row' self.pressFlag = False self.rowIteration = self.numberOfRows - 1 self.columnIteration = 0 self.countRows = 0 self.countColumns = 0 self.maxNumberOfRows = 2 self.maxNumberOfColumns = 2 self.numberOfPresses = 1 self.subSizerNumber = 0 if self.control != 'tracker': self.mouseCursor = PyMouse() self.mousePosition = self.winWidth - 10 - self.xBorder, self.winHeight - 12 - self.yBorder self.mouseCursor.move(*self.mousePosition) if self.switchSound.lower() != 'off' or self.pressSound.lower( ) != 'off': mixer.init() self.switchingSound = mixer.Sound(self.pathToAP + '/sounds/switchSound.ogg') self.pressingSound = mixer.Sound(self.pathToAP + '/sounds/pressSound.ogg') self.SetBackgroundColour('black') self.number = 0
def initializeParameters(self): with open( './.pathToAP' ,'r' ) as textFile: self.pathToATPlatform = textFile.readline( ) sys.path.append( self.pathToATPlatform ) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=')+1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=')+1:]) self.labels1 = [ 'A B C D E F G H I J K L M N O P R S T U W Y Z SPECIAL_CHARACTERS UNDO SPEAK SAVE SPACJA OPEN EXIT'.split( ), '1 2 3 4 5 6 7 8 9 0 + - * / = % $ & . , ; : " ? ! @ # ( ) [ ] { } < > ~ UNDO SPEAK SAVE SPACJA OPEN EXIT'.split( ) ] self.labels2 = [ 'A O N S Y P J G I Z W C D U B F E R T K M L H SPECIAL_CHARACTERS UNDO SPEAK SAVE SPACJA OPEN EXIT'.split( ), '1 2 3 4 5 6 7 8 9 0 + - * / = % $ & . , ; : " ? ! @ # ( ) [ ] { } < > ~ UNDO SPEAK SAVE SPACJA OPEN EXIT'.split( ) ] self.labels3 = [ 'A O Z R T D J G I U N S K M B F E Y W C P L H SPECIAL_CHARACTERS UNDO SPEAK SAVE SPACJA OPEN EXIT'.split( ), '1 2 3 4 5 6 7 8 9 0 + - * / = % $ & . , ; : " ? ! @ # ( ) [ ] { } < > ~ UNDO SPEAK SAVE SPACJA OPEN EXIT'.split( ) ] self.labels4 = [ 'A E B C D F G H I O J K L M N P U Y R S T W Z SPECIAL_CHARACTERS UNDO SPEAK SAVE SPACJA OPEN EXIT'.split( ), '1 2 3 4 5 6 7 8 9 0 + - * / = % $ & . , ; : " ? ! @ # ( ) [ ] { } < > ~ UNDO SPEAK SAVE SPACJA OPEN EXIT'.split( ) ] self.labels5 = ['A O N T D J G Ó I Z S K U B Ą Ć E W Y M Ł H Ś Ń R C P L Ę Ż F Ź UNDO SPEAK SAVE SPACJA SPECIAL_CHARACTERS OPEN EXIT'.split( ), '1 2 3 4 5 6 7 8 9 0 + - * / = % $ & . , ; : " ? ! @ # ( ) [ ] { } < > ~ UNDO SPEAK SAVE SPACJA OPEN EXIT'.split( )] self.labels6 = [ 'A O U W K J H Ą I Y R C M G Ę Ś E N T P B Ł Ż Ń Z S D L F Ó Ć Ź UNDO SPEAK SAVE SPACJA SPECIAL_CHARACTERS OPEN EXIT'.split( ), '1 2 3 4 5 6 7 8 9 0 + - * / = % $ & . , ; : " ? ! @ # ( ) [ ] { } < > ~ UNDO SPEAK SAVE SPACJA OPEN EXIT'.split( )] self.labels7 = [ 'A O Z W K J Ę Ó I Y R C M G Ą Ś E N T P B F Ż Ń U S D L H Ł Ć Ź UNDO SPEAK SAVE SPACJA SPECIAL_CHARACTERS OPEN EXIT'.split( ), '1 2 3 4 5 6 7 8 9 0 + - * / = % $ & . , ; : " ? ! @ # ( ) [ ] { } < > ~ UNDO SPEAK SAVE SPACJA OPEN EXIT'.split( )] self.labels = eval( 'self.labels'+str(self.spellerNumber) ) self.colouredLabels = [ 'A', 'E', 'I', 'O', 'U', 'Y' ] self.colouredLabels2 = [ 'Ą', 'Ć', 'Ę', 'Ł', 'Ń', 'Ó', 'Ś', 'Ź', 'Ż' ] if self.con != 0: if len( self.labels[ 0 ] ) == 30: self.numberOfRows = [ 4, 5 ] self.specialButtonsMarker = -3 self.startIndex = 4 elif len( self.labels[ 0 ] ) == 39: self.numberOfRows = [ 5, 5 ] self.specialButtonsMarker = -4 self.startIndex = 3 else: print 'Blad w definiowaniu tablicy' exit( ) self.numberOfColumns = [ 8, 9 ] self.flag = 'row' self.pressFlag = False self.rowIteration = 0 self.columnIteration = 0 self.countRows = 0 self.countColumns = 0 self.maxNumberOfRows = 2 self.maxNumberOfColumns = 2 self.numberOfPresses = 1 self.subSizerNumber = 0 if self.control != 'tracker': self.mouseCursor = PyMouse( ) self.mousePosition = self.winWidth - 8 - self.xBorder, self.winHeight - 8 - self.yBorder self.mouseCursor.move( *self.mousePosition ) mixer.init( ) if self.switchSound.lower( ) == 'on' or self.pressSound.lower( ) == 'on': if self.switchSound.lower( ) == 'on': self.switchingSound = mixer.Sound( self.pathToATPlatform + '/sounds/switchSound.ogg' ) if self.pressSound.lower( ) == 'on': self.pressingSound = mixer.Sound( self.pathToATPlatform + '/sounds/pressSound.ogg' ) if self.voice == 'True': self.phones = glob.glob( self.pathToATPlatform + 'sounds/phone/*' ) self.phoneLabels = [ item[ item.rfind( '/' )+1 : item.rfind( '.' ) ] for item in self.phones ] self.sounds = [ mixer.Sound( self.sound ) for self.sound in self.phones ] self.rows = glob.glob( self.pathToATPlatform + 'sounds/rows/*' ) self.rowLabels = [ item[ item.rfind( '/' )+1 : item.rfind( '.' ) ] for item in self.rows ] self.rowSounds = [ mixer.Sound( self.sound ) for self.sound in self.rows ] self.typewriterKeySound = mixer.Sound( self.pathToATPlatform + 'sounds/typewriter_key.ogg' ) self.typewriterForwardSound = mixer.Sound( self.pathToATPlatform + 'sounds/typewriter_forward.ogg' ) self.typewriterSpaceSound = mixer.Sound( self.pathToATPlatform + 'sounds/typewriter_space.ogg' ) self.SetBackgroundColour( 'black' )
def initializeParameters(self): with open('./.pathToAP', 'r') as textFile: self.pathToAP = textFile.readline() sys.path.append(self.pathToAP) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=') + 1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=') + 1:]) self.colorlegend = { '0': '#E5D9D9', '1': '#5545EA', '2': '#B229B7', '3': '#13CE1A', '4': '#CE1355', '5': '#F9F504', '6': '#FF7504', '7': '#FF0404', '8': '#000000' } self.options = ['restart', 'exit'] self.winstate = False self.move_info = False self.revert = False self.gamesize = (4, 5) #do ustalania self.indexes = np.arange(1, self.gamesize[0] * self.gamesize[1] / 2 + 1) self.game = memory.Memory_game(self.gamesize) self.labels = self.game.displayfield.flatten() self.numberOfRows = self.gamesize[0] + 1 self.numberOfColumns = self.gamesize[1] self.flag = 'row' self.pressFlag = False self.rowIteration = 0 self.columnIteration = 0 self.countRows = 0 self.countColumns = 0 self.maxNumberOfColumns = 2 self.maxNumberOfRows = 2 self.numberOfPresses = 1 self.subSizerNumber = 0 if self.control != 'tracker': self.mouseCursor = PyMouse() self.mousePosition = self.winWidth - 8 - self.xBorder, self.winHeight - 8 - self.yBorder if self.switchSound.lower() != 'off' or self.pressSound.lower( ) != 'off': mixer.init() self.switchingSound = mixer.Sound(self.pathToAP + '/sounds/switchSound.ogg') self.pressingSound = mixer.Sound(self.pathToAP + '/sounds/pressSound.ogg') self.SetBackgroundColour('black') self.path = self.pathToAP
def initializeParameters(self): with open('./.pathToAP', 'r') as textFile: self.pathToAP = textFile.readline() sys.path.append(self.pathToAP) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=') + 1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=') + 1:]) # with open( self.pathToAP + 'spellerParameters', 'r' ) as parametersFile: # for line in parametersFile: # if line[ :line.find('=')-1 ] == 'voice': # self.voice = line[ line.rfind('=')+2:-1 ] # elif line[ :line.find('=')-1 ] == 'vowelColour': # self.vowelColour = line[ line.rfind('=')+2:-1 ] # elif line[ :line.find('=')-1 ] == 'polishLettersColour': # self.polishLettersColour = line[ line.rfind('=')+2:-1 ] # elif not line.isspace( ): # print 'Niewłaściwie opisane parametry' # print 'Błąd w pliku spellerParameters w linii', line # self.voice = False # self.vowelColour = 'red' # self.polishLettersColour = 'blue' # with open( self.pathToAP + 'ewritingParameters', 'r' ) as parametersFile: # for line in parametersFile: # if line[ :line.find('=')-1 ] == 'textSize': # self.textSize = int( line[ line.rfind('=')+2:-1 ]) # elif line[ :line.find('=')-1 ] == 'maxPoints': # self.maxPoints = int(line[ line.rfind('=')+2:-1 ]) # elif line[ :line.find('=')-1 ] == 'checkTime': # self.checkTime = int(line[ line.rfind('=')+2:-1 ]) # elif line[ :line.find('=')-1 ] == 'colorGrat': # self.colorGrat = line[ line.rfind('=')+2:-1 ] # elif line[ :line.find('=')-1 ] == 'colorNiest': # self.colorNiest = line[ line.rfind('=')+2:-1 ] # elif line[ :line.find('=')-1 ] == 'ileLuk': # self.ileLuk = int(line[ line.rfind('=')+2:-1 ]) # elif line[ :line.find('=')-1 ] == 'sex': # self.sex = line[ line.rfind('=')+2:-1 ] # elif not line.isspace( ): # print 'Niewłaściwie opisane parametry' # print 'Błąd w linii', line self.textSize = 80 self.checkTime = 8000 self.colorGrat = 'lime green' self.colorNiest = 'indian red' self.ileLuk = 1 self.maxPoints = 2 self.sex = 'D' self.ownWord = '' self.flaga = 0 self.PicNr = 0 self.result = 0 self.WordsList = os.listdir(self.pathToAP + 'multimedia/ewriting/pictures') shuffle(self.WordsList) self.poczatek = True self.numberOfPresses = 1 self.czyBack = False self.mouseCursor = PyMouse() self.mousePosition = self.winWidth - 8, self.winHeight - 8 self.mouseCursor.move(*self.mousePosition) mixer.init()
def initializeParameters(self): with open( './.pathToAP' ,'r' ) as textFile: self.pathToAP = textFile.readline( ) sys.path.append( self.pathToAP ) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=')+1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=')+1:]) # with open( self.pathToAP + 'spellerParameters', 'r' ) as parametersFile: # for line in parametersFile: # if line[ :line.find('=')-1 ] == 'voice': # self.voice = line[ line.rfind('=')+2:-1 ] # elif line[ :line.find('=')-1 ] == 'vowelColour': # self.vowelColour = line[ line.rfind('=')+2:-1 ] # elif line[ :line.find('=')-1 ] == 'polishLettersColour': # self.polishLettersColour = line[ line.rfind('=')+2:-1 ] # elif not line.isspace( ): # print 'Niewłaściwie opisane parametry' # print 'Błąd w pliku spellerParameters w linii', line # self.voice = False # self.vowelColour = 'red' # self.polishLettersColour = 'blue' # with open( self.pathToAP + 'ewritingParameters', 'r' ) as parametersFile: # for line in parametersFile: # if line[ :line.find('=')-1 ] == 'textSize': # self.textSize = int( line[ line.rfind('=')+2:-1 ]) # elif line[ :line.find('=')-1 ] == 'maxPoints': # self.maxPoints = int(line[ line.rfind('=')+2:-1 ]) # elif line[ :line.find('=')-1 ] == 'checkTime': # self.checkTime = int(line[ line.rfind('=')+2:-1 ]) # elif line[ :line.find('=')-1 ] == 'colorGrat': # self.colorGrat = line[ line.rfind('=')+2:-1 ] # elif line[ :line.find('=')-1 ] == 'colorNiest': # self.colorNiest = line[ line.rfind('=')+2:-1 ] # elif line[ :line.find('=')-1 ] == 'ileLuk': # self.ileLuk = int(line[ line.rfind('=')+2:-1 ]) # elif line[ :line.find('=')-1 ] == 'sex': # self.sex = line[ line.rfind('=')+2:-1 ] # elif not line.isspace( ): # print 'Niewłaściwie opisane parametry' # print 'Błąd w linii', line # self.textSize = 80 # self.checkTime = 8000 # self.colorGrat = 'lime green' # self.colorNiest = 'indian red' # self.ileLuk = 1 # self.maxPoints = 2 # self.sex = 'D' self.labels = [ 'A E B C D F G H I O J K L M N P U Y R S T W Z SPECIAL_CHARACTERS DELETE TRASH CHECK ORISPEAK SPEAK EXIT'.split( ), '1 2 3 4 5 6 7 8 9 0 + - * / = % $ & . , ; : " ? ! @ # ( ) [ ] { } < > ~ DELETE TRASH CHECK ORISPEAK SPEAK EXIT'.split( ) ] self.colouredLabels = [ 'A','E','I','O','U','Y'] self.winWidth, self.winHeight = wx.DisplaySize( ) self.voice = False self.slowo = self.parent.WORD self.ileLiter = len( self.slowo ) self.numberOfRows = [ 4, 5 ] self.numberOfColumns = [ 8, 9 ] self.kolejnyKrok = 0 self.numberOfPresses = 1 self.subSizerNumber = 0 self.mouseCursor = PyMouse( ) self.mousePosition = self.winWidth - 8, self.winHeight - 8 self.mouseCursor.move( *self.mousePosition ) mixer.init( ) self.typewriterKeySound = mixer.Sound( self.pathToAP + 'sounds/typewriter_key.ogg' ) self.typewriterForwardSound = mixer.Sound( self.pathToAP + 'sounds/typewriter_forward.ogg' ) self.typewriterSpaceSound = mixer.Sound( self.pathToAP + 'sounds/typewriter_space.ogg' ) self.phones = glob.glob( self.pathToAP + 'sounds/phone/*' ) self.phoneLabels = [ item[ item.rfind( '/' )+1 : item.rfind( '.' ) ] for item in self.phones ] self.sounds = [ mixer.Sound( self.sound ) for self.sound in self.phones ] self.parent.SetBackgroundColour( 'black' )
def initializeParameters(self): with open('./.pathToAP', 'r') as textFile: self.pathToAP = textFile.readline() sys.path.append(self.pathToAP) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=') + 1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=') + 1:]) self.panelIteration = 0 self.rowIteration = 0 self.columnIteration = 0 self.defaultNumberOfColumns = 6 self.defaultNumberOfRows = 4 self.countRows = 0 self.countColumns = 0 self.button = 1 self.countMaxRows = 2 self.countMaxColumns = 2 self.numberOfPresses = 0 self.numberOfSymbol = 0 self.flag = 'panel' if self.control != 'tracker': self.mouseCursor = PyMouse() self.mousePosition = self.winWidth - 8 - self.xBorder, self.winHeight - 8 - self.yBorder self.mouseCursor.move(*self.mousePosition) if self.switchSound.lower() != 'off' or self.pressSound.lower( ) != 'off': mixer.init() self.switchingSound = mixer.Sound(self.pathToAP + '/sounds/switchSound.ogg') self.pressingSound = mixer.Sound(self.pathToAP + '/sounds/pressSound.ogg') self.oneSound = mixer.Sound(self.pathToAP + '/sounds/rows/1.ogg') self.twoSound = mixer.Sound(self.pathToAP + '/sounds/rows/2.ogg') self.powrotSound = mixer.Sound(self.pathToAP + '/sounds/powrot.ogg') self.pusteSound = mixer.Sound(self.pathToAP + '/sounds/puste.ogg') self.pageFlipSounds = glob.glob(self.pathToAP + 'sounds/page_flip/*') self.pageFlipSound = mixer.Sound(self.pageFlipSounds[1]) self.lastPageFlipSound = mixer.Sound(self.pathToAP + 'sounds/page-flip-13.ogg') self.pageFlipSounds = [ mixer.Sound(self.pageFlipSound) for self.pageFlipSound in self.pageFlipSounds ] self.SetBackgroundColour('black')
def initializeParameters(self): textFile = codecs.open("./.pathToAP", mode="r", encoding="utf-8") self.pathToAP = textFile.readline() textFile.close() sys.path.append(self.pathToAP) from reader import reader reader = reader() reader.readParameters() parameters = reader.getParameters() for item in parameters: try: setattr(self, item[:item.find('=')], int(item[item.find('=') + 1:])) except ValueError: setattr(self, item[:item.find('=')], item[item.find('=') + 1:]) sys.path.append(self.pathToAP + 'modules/others') from speller import speller sp = speller(parent=None, id=-1, con=0) label = sp.getLabels() sp.onExit() label1 = label[0] label2 = label[1] self.partLabel1, self.partLabel2 = [], [] for item in label1: if len(item) == 1 or len(item) == 2: self.partLabel1.append(item) else: continue for item in label2: if len(item) == 1 or len(item) == 2: self.partLabel2.append(item) else: continue if len(self.partLabel1) == 23: self.labels = [ self.partLabel1 + 'SPECIAL_CHARACTERS DELETE TRASH CHECK ORISPEAK SPEAK EXIT'. split(), self.partLabel2 + 'DELETE TRASH CHECK ORISPEAK SPEAK EXIT'.split() ] self.numberOfRows = [4, 5] self.specialButtonsMarker = -3 self.startIndex = -7 self.spaceButton = 3 elif len(self.partLabel1) == 32: self.labels = [ self.partLabel1 + 'DELETE TRASH CHECK ORISPEAK SPEAK EXIT'.split(), self.partLabel2 + 'DELETE TRASH CHECK ORISPEAK SPEAK EXIT'.split() ] self.numberOfRows = [5, 5] self.specialButtonsMarker = -4 self.startIndex = -6 self.spaceButton = 2 else: print 'Blad w definiowaniu tablicy' exit() self.colouredLabels = ['A', 'E', 'I', 'O', 'U', 'Y'] self.colouredLabels2 = ['Ą', 'Ć', 'Ę', 'Ł', 'Ń', 'Ó', 'Ś', 'Ź', 'Ż'] self.numberOfColumns = [8, 9] mixer.init() if self.switchSound.lower() != 'off' or self.pressSound.lower( ) != 'off': self.switchingSound = mixer.Sound(self.pathToAP + '/sounds/switchSound.ogg') self.pressingSound = mixer.Sound(self.pathToAP + '/sounds/pressSound.ogg') if self.voice == 'True': self.phones = glob.glob(self.pathToAP + 'sounds/phone/*') self.phoneLabels = [ item[item.rfind('/') + 1:item.rfind('.')] for item in self.phones ] self.sounds = [ mixer.Sound(self.sound) for self.sound in self.phones ] self.rows = glob.glob(self.pathToAP + 'sounds/rows/*') self.rowLabels = [ item[item.rfind('/') + 1:item.rfind('.')] for item in self.rows ] self.rowSounds = [ mixer.Sound(self.sound) for self.sound in self.rows ] self.SLOWO = self.parent.WORD self.slowo = self.parent.word if self.ileLuk >= len(self.SLOWO): self.ileLuk = len(self.SLOWO) - 1 self.flag = 'row' self.pressFlag = False self.rowIteration = 0 self.columnIteration = 0 self.countRows = 0 self.countColumns = 0 self.maxNumberOfRows = 2 self.maxNumberOfColumns = 2 self.numberOfPresses = 1 self.subSizerNumber = 0 self.mouseCursor = PyMouse() self.mousePosition = self.winWidth - 8 - self.xBorder, self.winHeight - 8 - self.yBorder self.mouseCursor.move(*self.mousePosition) self.typewriterKeySound = mixer.Sound(self.pathToAP + 'sounds/typewriter_key.ogg') self.typewriterForwardSound = mixer.Sound( self.pathToAP + 'sounds/typewriter_forward.ogg') self.typewriterSpaceSound = mixer.Sound(self.pathToAP + 'sounds/typewriter_space.ogg') self.parent.SetBackgroundColour('black')