コード例 #1
0
ファイル: FamilyTab.py プロジェクト: Gerj17/FamilyTree-1
    def OnAddSpouse(self):

        idsExcluded = [ self.idIndividual ]

        theIndividual = self.ftGraph.GetIndividual( self.idIndividual )
        mother, father, idFamilyChild = self.ftGraph.GetParents( theIndividual )

        if ( not father is None ):
            idsExcluded.append( self.ftGraph.GetIndividualID( father ) )

        if ( not mother is None ):
            idsExcluded.append( self.ftGraph.GetIndividualID( mother ) )

        sex = theIndividual.findtext('SEX')

        self.idSelectedSpouse = None

        if ( sex == 'M' ):

            d = Dialogs.DialogSelectSubject( self.master, self.ftGraph, 'Select a spouse',
                                             self.OnSelectedSpouse, self.OnSelectedSpouseCancel,
                                             [ '***  New Individual ***' ],
                                             'F', idsExcluded )
        elif ( sex == 'F' ):

            d = Dialogs.DialogSelectSubject( self.master, self.ftGraph, 'Select a spouse',
                                             self.OnSelectedSpouse, self.OnSelectedSpouseCancel,
                                             [ '***  New Individual ***' ],
                                             'M', idsExcluded )
        else:

            tkMessageBox.showwarning( 'Warning',
                                      'Please set the gender of this subject before adding a spouse.' )
            return

        # Create a new spouse?

        if ( self.idSelectedSpouse is None ):

            return

        elif ( self.idSelectedSpouse == '***  New Individual ***' ):

            self.idSelectedSpouse = self.GetNewIndividual()

        else:

            self.idSelectedSpouse = re.search( 'I\d\d\d$', self.idSelectedSpouse ).group( 0 )

        # Set the spouse

        if ( sex == 'M' ):
            self.ftGraph.SetSex( self.idSelectedSpouse, 'F' )
        elif ( sex == 'F' ):
            self.ftGraph.SetSex( self.idSelectedSpouse, 'M' )

        self.ftGraph.SetSpouse( self.idIndividual, self.idSelectedSpouse,  self.idFamily )
        self.ftGraph.SetSpouse( self.idSelectedSpouse, self.idIndividual,  self.idFamily )

        self.UpdateSelectedSubject()
コード例 #2
0
 def toggleAutoPlay(self):
   self.autoPlay = not self.autoPlay
   if self.autoPlay:
     Dialogs.showMessage(self.engine, _("Jurgen will show you how it is done."))
   else:
     Dialogs.showMessage(self.engine, _("Jurgen has left the building."))
   return self.autoPlay
コード例 #3
0
  def newLocalGame(self, players=1, mode1p=0, mode2p=0): #mode1p=0(quickplay),1(practice),2(career) / mode2p=0(faceoff),1(profaceoff)
    self.engine.data.acceptSound.play()
    players = Dialogs.activateControllers(self.engine, players) #akedrou
    if players > 2: #hey look! Multiplayer support without the hassle!
      players = 2   #just comment these lines and everything will work! I promise!
    elif players == 0:
      return
    Config.set("game", "players", players)
    Config.set("game","game_mode", mode1p)
    Config.set("game","multiplayer_mode", mode2p)
    if Config.get("game", "tut") == True:
      Config.set("game", "tut", False)
      #Config.set("game", "selected_library", "")
      #Config.set("game", "selected_song", "")

    #MFH - testing new traceback logging:
    #raise TypeError


    if self.engine.isServerRunning():
      return
    self.engine.startServer()
    self.engine.resource.load(self, "session", lambda: self.engine.connect("127.0.0.1"), synch = True)
    
    if Dialogs.showLoadingScreen(self.engine, lambda: self.session and self.session.isConnected):
      self.launchLayer(lambda: Lobby(self.engine, self.session, singlePlayer = True))
コード例 #4
0
    def render(self, visibility, topMost):
        v = 1.0 - ((1 - visibility)**2)

        # render the background
        t = self.time / 100 + 34
        w, h, = self.engine.view.geometry[2:4]

        self.engine.view.setOrthogonalProjection(normalize=True)
        Dialogs.fadeScreen(.4)
        font = self.engine.data.font
        self.doneList = []

        # render the scroller elements
        y = self.offset
        glTranslatef(-(1 - v), 0, 0)
        try:
            for element in self.credits:
                h = element.getHeight()
                if y + h > 0.0 and y < 1.0:
                    element.render(y)
                if y + h < 0.0:
                    self.doneList.append(element)
                y += h
                if y > 1.0:
                    break
        finally:
            self.engine.view.resetProjection()
コード例 #5
0
ファイル: Credits.py プロジェクト: Gamer125/fofix
  def render(self, visibility, topMost):
    v = 1.0 - ((1 - visibility) ** 2)
    
    # render the background    
    t = self.time / 100 + 34
    w, h, = self.engine.view.geometry[2:4]
    
    self.engine.view.setOrthogonalProjection(normalize = True)
    Dialogs.fadeScreen(.4)
    font = self.engine.data.font
    self.doneList = []

    # render the scroller elements
    y = self.offset
    glTranslatef(-(1 - v), 0, 0)
    try:
      for element in self.credits:
        h = element.getHeight()
        if y + h > 0.0 and y < 1.0:
          element.render(y)
        if y + h < 0.0:
          self.doneList.append(element)
        y += h
        if y > 1.0:
          break
    finally:
      self.engine.view.resetProjection()
コード例 #6
0
ファイル: MainMenu.py プロジェクト: zelurker/fofix
  def showTutorial(self):
    # evilynux - Make sure tutorial exists before launching
    #tutorialpath = self.engine.getPath(os.path.join("songs","tutorial"))
    tutorialpath = self.engine.tutorialFolder
    if not os.path.isdir(self.engine.resource.fileName(tutorialpath)):
      Log.debug("No folder found: %s" % tutorialpath)
      Dialogs.showMessage(self.engine, _("No tutorials found!"))
      return

    if self.engine.isServerRunning():
      return

    players = Dialogs.activateControllers(self.engine, 1) #akedrou
    if players == 0:
      return
    
    Config.set("game","game_mode", 0)    #MFH - ensure tutorial can work with new logic that depends on this mode variable
    Config.set("game","multiplayer_mode", 0)    #MFH - ensure tutorial can work with new logic that depends on this mode variable
    Config.set("game", "players", 1)
    Config.set("game", "tut", True)
    
    #Config.set("game","game_mode", 1) #MFH - don't force practice mode.... this is problematic.

    self.engine.startServer()
    self.engine.resource.load(self, "session", lambda: self.engine.connect("127.0.0.1"), synch = True)

    if Dialogs.showLoadingScreen(self.engine, lambda: self.session and self.session.isConnected):
      self.launchLayer(lambda: Lobby(self.engine, self.session, singlePlayer = True))
コード例 #7
0
  def keyPressed(self, key, unicode):
    ret = SceneClient.keyPressed(self, key, unicode)

    c = self.controls.keyPressed(key)
    if self.song and (c in [Player.KEY1, Player.KEY2, Player.CANCEL, Player.ACTION1, Player.ACTION2] or key == pygame.K_RETURN):
      scores = self.song.info.getHighscores(self.player.difficulty)
      if not scores or self.player.score > scores[-1][0] or len(scores) < 5:
        if self.player.cheating:
          Dialogs.showMessage(self.engine, _("No highscores for cheaters!"))
        else:
          name = Dialogs.getText(self.engine, _("%d points is a new high score! Please enter your name:") % self.player.score, self.player.name)
          if name:
            self.player.name = name
          self.highscoreIndex = self.song.info.addHighscore(self.player.difficulty, self.player.score, self.stars, self.player.name)
          self.song.info.save()

          if self.engine.config.get("game", "uploadscores"):
            self.uploadingScores = True
            fn = lambda: self.song.info.uploadHighscores(self.engine.config.get("game", "uploadurl"), self.song.getHash())
            self.engine.resource.load(self, "uploadResult", fn)

      self.showHighscores = True
      self.engine.view.pushLayer(self.menu)
      return True
    
    return ret
コード例 #8
0
ファイル: Credits.py プロジェクト: chk666/fofix
    def render(self, visibility, topMost):
        v = 1.0 - ((1 - visibility) ** 2)

        # render the background
        w, h = self.engine.view.geometry[2:4]

        with self.engine.view.orthogonalProjection(normalize = True):
            if self.background:
                self.engine.drawImage(self.background, scale = (1.0,-1.0), coord = (w/2,h/2), stretched = 3)
            else:
                Dialogs.fadeScreen(.4)
            self.doneList = []

            # render the scroller elements
            y = self.offset
            glTranslatef(-(1 - v), 0, 0)
            for element in self.credits:
                hE = element.getHeight()
                if y + hE > 0.0 and y < 1.0:
                    element.render(y)
                if y + hE < 0.0:
                    self.doneList.append(element)
                y += hE
                if y > 1.0:
                    break
            if self.topLayer:
                wFactor = 640.000/self.topLayer.width1()
                hPos = h - ((self.topLayer.height1() * wFactor)*.75)
                if hPos < h * .6:
                    hPos = h * .6
                self.engine.drawImage(self.topLayer, scale = (wFactor,-wFactor), coord = (w/2,hPos))
コード例 #9
0
ファイル: GuitarScene.py プロジェクト: fculpo/fof-reborn
 def toggleAutoPlay(self):
     self.autoPlay = not self.autoPlay
     if self.autoPlay:
         Dialogs.showMessage(self.engine, _("Jurgen will show you how it is done."))
     else:
         Dialogs.showMessage(self.engine, _("Jurgen has left the building."))
     return self.autoPlay
コード例 #10
0
ファイル: MainMenu.py プロジェクト: Gamer125/fofix
    def showTutorial(self):
        # evilynux - Make sure tutorial exists before launching
        tutorialpath = self.engine.getPath(os.path.join("songs", "tutorial"))
        if not os.path.exists(tutorialpath):
            Dialogs.showMessage(self.engine,
                                _("No tutorial found in your song library!"))
            return

        if self.engine.isServerRunning():
            return

        Config.set(
            "player0", "mode_1p", 0
        )  #MFH - ensure tutorial can work with new logic that depends on this mode variable
        Config.set(
            "player0", "mode_2p", 0
        )  #MFH - ensure tutorial can work with new logic that depends on this mode variable
        Config.set("game", "players", 1)

        self.engine.startServer()
        self.engine.resource.load(self,
                                  "session",
                                  lambda: self.engine.connect("127.0.0.1"),
                                  synch=True)

        if Dialogs.showLoadingScreen(
                self.engine,
                lambda: self.session and self.session.isConnected):
            self.launchLayer(lambda: Lobby(
                self.engine, self.session, singlePlayer=True, tutorial=True))
コード例 #11
0
ファイル: GameEngine.py プロジェクト: Hawkheart/fof-reborn
    def run(self):
        try:
            return self.mainloop()
        except KeyboardInterrupt:
            sys.exit(0)
        except SystemExit:
            sys.exit(0)
        except Exception, e:
            def clearMatrixStack(stack):
                try:
                    glMatrixMode(stack)
                    for i in range(16):
                        glPopMatrix()
                except:
                    pass

            if self.handlingException:
                # A recursive exception is fatal as we can't reliably reset the GL state
                sys.exit(1)

            self.handlingException = True
            Log.error("%s: %s" % (e.__class__, e))
            import traceback
            traceback.print_exc()

            clearMatrixStack(GL_PROJECTION)
            clearMatrixStack(GL_MODELVIEW)

            Dialogs.showMessage(self, unicode(e))
            self.handlingException = False
            return True
コード例 #12
0
  def createClient(self, libraryName, songName, players = None):
    self.libraryName     = libraryName
    self.songName        = songName
    self.stars           = [0 for i in players]
    self.accuracy        = [0 for i in players]
    self.counter         = 0
    self.showHighscores  = False
    self.highscoreIndex  = [None for i in players]
    self.taunt           = None
    self.uploadingScores = False
    self.nextScene       = None
    self.offset          = None
    self.pauseScroll     = None
    self.scorePart       = None
    self.scoreDifficulty = None
    self.playerList      = players

    self.spinnyDisabled   = self.engine.config.get("game", "disable_spinny")    

    items = [
      (_("Replay"),            self.replay),
      (_("Change Song"),       self.changeSong),
      (_("Quit to Main Menu"), self.quit),
    ]
    self.menu = Menu(self.engine, items, onCancel = self.quit, pos = (.2, .5))
      
    self.engine.resource.load(self, "song", lambda: Song.loadSong(self.engine, songName, library = self.libraryName, notesOnly = True, part = [player.part for player in self.playerList]), onLoad = self.songLoaded)
    self.engine.loadSvgDrawing(self, "background", "gameresults.svg")

    phrase = random.choice(Theme.resultsPhrase.split(","))
    if phrase == "None":
      phrase = _("Chilling...")
    Dialogs.showLoadingScreen(self.engine, lambda: self.song, text = phrase)
コード例 #13
0
    def run(self):
        try:
            return self.mainloop()
        except KeyboardInterrupt:
            sys.exit(0)
        except SystemExit:
            sys.exit(0)
        except Exception, e:

            def clearMatrixStack(stack):
                try:
                    glMatrixMode(stack)
                    for i in range(16):
                        glPopMatrix()
                except:
                    pass

            if self.handlingException:
                # A recursive exception is fatal as we can't reliably reset the GL state
                sys.exit(1)

            self.handlingException = True
            Log.error("%s: %s" % (e.__class__, e))
            import traceback
            traceback.print_exc()

            clearMatrixStack(GL_PROJECTION)
            clearMatrixStack(GL_MODELVIEW)

            Dialogs.showMessage(self, unicode(e))
            self.handlingException = False
            return True
コード例 #14
0
  def createClient(self, libraryName, songName, players = 1): #players = None
    Log.debug("GameResultsSceneClient class init...")
    self.libraryName     = libraryName
    self.songName        = songName
    self.stars           = [0 for i in players]
    self.accuracy        = [0 for i in players]
    self.counter         = 0
    self.showHighscores  = False
    self.highscoreIndex  = [-1 for i in players]
    self.taunt           = None
    self.uploadingScores = False
    self.uploadResult    = None
    self.nextScene       = None
    self.offset          = None
    self.pauseScroll     = None
    self.scorePart       = None
    self.scoreDifficulty = None
    self.playerList      = players
    self.spinnyDisabled   = True#NO SPINNY!!!    

    #myfingershurt: reordering so default is Change Song.
    items = [
      (_("Continue"),       self.changeSong),
      (_("Replay"),            self.replay),
      (_("Quit"), self.quit),
    ]
    self.menu = Menu(self.engine, items, onCancel = self.quit, pos = (.2, .5))
      
    self.engine.resource.load(self, "song", lambda: Song.loadSong(self.engine, songName, library = self.libraryName, notesOnly = True, part = [player.part for player in self.playerList]), onLoad = self.songLoaded)

    #Get theme
    themename = self.engine.data.themeLabel
    #now theme determination logic is only in data.py:
    self.theme = self.engine.data.theme
      
    self.starScoring = self.engine.config.get("game", "star_scoring")#MFH
    self.Congratphrase = self.engine.config.get("game", "congrats")#blazingamer

    self.resultCheerLoop = self.engine.config.get("game", "result_cheer_loop")#MFH
    self.cheerLoopDelay = self.engine.config.get("game", "cheer_loop_delay")#MFH
    self.cheerLoopCounter = self.cheerLoopDelay   #MFH - starts out ready to cheer
      
    self.engine.loadImgDrawing(self, "background", os.path.join("themes",themename,"gameresults.png"))

    phrase = random.choice(Theme.resultsPhrase.split("_"))
    if phrase == "None":
      i = random.randint(0,5)
      if i == 0:
        phrase = _("Relax, it was an excellent show.")
      elif i == 1:
        phrase = _("Truly Amazing!")
      elif i == 2:
        phrase = _("Thanks for playing!")
      elif i == 3:
        phrase = _("One more song can't hurt, can it?")
      elif i == 4:
        phrase = _("What an amazing performance!")
      else:
        phrase = _("That's how it's done!")
    Dialogs.showLoadingScreen(self.engine, lambda: self.song, text = phrase)
コード例 #15
0
    def on_btnRemoveClicked(self, widget):
        action = Dialogs.remove_user_dialog(self._active_user)
        if action == False:
            return
        
        #mark user to delete
        try:
            deleteuser = serverconf.UsersConf.Users()
            deleteuser.set_actiontorun('delete')
            deleteuser.set_user(self._active_user['login'])
            deleteuser.set_deletehome(action[1])
            
            #remove any operation on the user we are going to delete
            users_conf = self.serverconf.get_users_conf()
            userlist = []
            createdUser = False
            for user in users_conf.get_users_list():
                #operation on a different user, ok
                if user.get_user() == deleteuser.get_user(): 
                    if user.get_actiontorun() == 'create':
                        users_conf.remove_user_from_list(user)
                        createdUser = True
                        break
                    else:
                        users_conf.remove_user_from_list(user)
                        break
            
            if not createdUser:
                users_conf.add_user_to_list(deleteuser)
            
            self.delete_user_treeview(deleteuser)
            self._select_user()

        except LocalUsersException as e:
            Dialogs.user_error_dialog(e.message)
コード例 #16
0
ファイル: Editor.py プロジェクト: fretsonfire/fof-python
 def help(self):
   Dialogs.showMessage(self.engine, _("Editing keys: ") +
                                    _("Arrows - Move cursor, ") +
                                    _("Space - Play/pause song, ") +
                                    _("Enter - Make note (hold and move for long notes), ") +
                                    _("Delete - Delete note, ") +
                                    _("Page Up/Down - Change difficulty"))
コード例 #17
0
ファイル: MainMenu.py プロジェクト: maggotgdv/fofix
 def shown(self):
     self.engine.view.pushLayer(self.menu)
     shaders.checkIfEnabled()
     if not self.shownOnce:
         self.shownOnce = True
         if hasattr(sys, 'frozen'):
             # Check whether this is a release binary being run from an svn/git
             # working copy or whether this is an svn/git binary not being run
             # from an corresponding working copy.
             currentVcs, buildVcs = None, None
             if VFS.isdir('/gameroot/.git'):
                 currentVcs = 'git'
             elif VFS.isdir('/gameroot/src/.svn'):
                 currentVcs = 'Subversion'
             if 'git' in Version.version():
                 buildVcs = 'git'
             elif 'svn' in Version.version():
                 buildVcs = 'Subversion'
             if currentVcs != buildVcs:
                 if buildVcs is None:
                     msg = _('This binary release is being run from a %(currentVcs)s working copy. This is not the correct way to run FoFiX from %(currentVcs)s. Please see one of the following web pages to set your %(currentVcs)s working copy up correctly:') + \
                           '\n\nhttp://code.google.com/p/fofix/wiki/RunningUnderPython26' + \
                           '\nhttp://code.google.com/p/fofix/wiki/RequiredSourceModules'
                 else:
                     msg = _('This binary was built from a %(buildVcs)s working copy but is not running from one. The FoFiX Team will not provide any support whatsoever for this binary. Please see the following site for official binary releases:') + \
                           '\n\nhttp://code.google.com/p/fofix/'
                 Dialogs.showMessage(self.engine, msg % {'buildVcs': buildVcs, 'currentVcs': currentVcs})
コード例 #18
0
ファイル: __init__.py プロジェクト: ahdiaz/gecos-firstboot
    def on_btnApplyClicked(self, widget):

        update_passwd = False

        if self.ui.txtPassword.get_text() != __DUMMY_PASSWORD__:
            update_passwd = True

        user = {
            'login': self._active_user['login'],
            'name': self.ui.txtName.get_text(),
            'password': self.ui.txtPassword.get_text(),
            'confirm': self.ui.txtConfirm.get_text(),
            'groups': self.ui.txtGroups.get_text()
        }

        if not self.validate_user(user):
            return

        try:
            SystemUsers.update_user(user, update_passwd)
            self.reload_page()
            self._select_user()

        except SystemUsers.SystemUserException as e:
            Dialogs.user_error_dialog(e.message)
コード例 #19
0
ファイル: MainMenu.py プロジェクト: cherbib/fofix
 def shown(self):
   self.engine.view.pushLayer(self.menu)
   shaders.checkIfEnabled()
   if not self.shownOnce:
     self.shownOnce = True
     if hasattr(sys, 'frozen'):
       # Check whether this is a release binary being run from an svn/git
       # working copy or whether this is an svn/git binary not being run
       # from an corresponding working copy.
       currentVcs, buildVcs = None, None
       if VFS.isdir('/gameroot/.git'):
         currentVcs = 'git'
       elif VFS.isdir('/gameroot/src/.svn'):
         currentVcs = 'Subversion'
       if 'git' in Version.version():
         buildVcs = 'git'
       elif 'svn' in Version.version():
         buildVcs = 'Subversion'
       if currentVcs != buildVcs:
         if buildVcs is None:
           msg = _('This binary release is being run from a %(currentVcs)s working copy. This is not the correct way to run FoFiX from %(currentVcs)s. Please see one of the following web pages to set your %(currentVcs)s working copy up correctly:') + \
                 '\n\nhttp://code.google.com/p/fofix/wiki/RunningUnderPython26' + \
                 '\nhttp://code.google.com/p/fofix/wiki/RequiredSourceModules'
         else:
           msg = _('This binary was built from a %(buildVcs)s working copy but is not running from one. The FoFiX Team will not provide any support whatsoever for this binary. Please see the following site for official binary releases:') + \
                 '\n\nhttp://code.google.com/p/fofix/'
         Dialogs.showMessage(self.engine, msg % {'buildVcs': buildVcs, 'currentVcs': currentVcs})
コード例 #20
0
    def createClient(self, libraryName, songName):
        self.libraryName = libraryName
        self.songName = songName
        self.stars = 0
        self.accuracy = 0
        self.counter = 0
        self.showHighscores = False
        self.highscoreIndex = None
        self.taunt = None
        self.uploadingScores = False
        self.nextScene = None

        items = [
            (_("Replay"), self.replay),
            (_("Change Song"), self.changeSong),
            (_("Quit to Main Menu"), self.quit),
        ]
        self.menu = Menu(self.engine, items, onCancel=self.quit, pos=(.2, .5))

        self.engine.resource.load(
            self,
            "song",
            lambda: Song.loadSong(self.engine,
                                  songName,
                                  library=self.libraryName,
                                  notesOnly=True),
            onLoad=self.songLoaded)
        self.engine.loadSvgDrawing(self, "background", "keyboard.svg")
        Dialogs.showLoadingScreen(self.engine,
                                  lambda: self.song,
                                  text=_("Chilling..."))
コード例 #21
0
    def on_btnRemoveClicked(self, widget):
        action = Dialogs.remove_user_dialog(self._active_user)
        if action == False:
            return

        #mark user to delete
        try:
            deleteuser = serverconf.UsersConf.Users()
            deleteuser.set_actiontorun('delete')
            deleteuser.set_user(self._active_user['login'])
            deleteuser.set_deletehome(action[1])

            #remove any operation on the user we are going to delete
            users_conf = self.serverconf.get_users_conf()
            userlist = []
            createdUser = False
            for user in users_conf.get_users_list():
                #operation on a different user, ok
                if user.get_user() == deleteuser.get_user():
                    if user.get_actiontorun() == 'create':
                        users_conf.remove_user_from_list(user)
                        createdUser = True
                        break
                    else:
                        users_conf.remove_user_from_list(user)
                        break

            if not createdUser:
                users_conf.add_user_to_list(deleteuser)

            self.delete_user_treeview(deleteuser)
            self._select_user()

        except LocalUsersException as e:
            Dialogs.user_error_dialog(e.message)
コード例 #22
0
ファイル: Settings.py プロジェクト: Gamer125/fofix
  def change(self):
    o = self.config.prototype[self.section][self.option]

    if isinstance(o.options, dict):
      for k, v in o.options.items():
        if v == value:
          value = k
          break

    key = Dialogs.getKey(self.engine, _("Press a key for '%s' or Escape to cancel.") % (o.text))

    if key:
      #------------------------------------------
      
      #myfingershurt: key conflict checker operation mode
      if self.keyCheckerMode == 2:    #enforce; do not allow conflicting key assignments, force reversion
        # glorandwarf: sets the new key mapping and checks for a conflict
        if self.engine.input.setNewKeyMapping(self.section, self.option, key) == False:
          # key mapping would conflict, warn the user
          Dialogs.showMessage(self.engine, _("That key is already in use. Please choose another."))
        self.engine.input.reloadControls()

      elif self.keyCheckerMode == 1:    #just notify, but allow the change
        # glorandwarf: sets the new key mapping and checks for a conflict
        if self.engine.input.setNewKeyMapping(self.section, self.option, key) == False:
          # key mapping would conflict, warn the user
          Dialogs.showMessage(self.engine, _("A key conflict exists somewhere. You should fix it."))
        self.engine.input.reloadControls()
      
      else:   #don't even check.
        # glorandwarf: sets the new key mapping and checks for a conflict
        temp = self.engine.input.setNewKeyMapping(self.section, self.option, key)
          # key mapping would conflict, warn the user
        self.engine.input.reloadControls()
コード例 #23
0
ファイル: MainMenu.py プロジェクト: zelurker/fofix
  def newLocalGame(self, players=1, mode1p=0, mode2p=0, maxplayers = None, allowGuitar = True, allowDrum = True, allowMic = False): #mode1p=0(quickplay),1(practice),2(career) / mode2p=0(faceoff),1(profaceoff)
    self.engine.data.acceptSound.play()
    players = Dialogs.activateControllers(self.engine, players, maxplayers, allowGuitar, allowDrum, allowMic) #akedrou
    if players == 0:
      if self.engine.cmdPlay == 2:
        self.engine.cmdPlay = 0
      return
    Config.set("game", "players", players)
    Config.set("game","game_mode", mode1p)
    Config.set("game","multiplayer_mode", mode2p)
    if Config.get("game", "tut") == True:
      Config.set("game", "tut", False)
      #Config.set("game", "selected_library", "")
      #Config.set("game", "selected_song", "")

    #MFH - testing new traceback logging:
    #raise TypeError

    if self.engine.isServerRunning():
      return
    self.engine.startServer()
    self.engine.resource.load(self, "session", lambda: self.engine.connect("127.0.0.1"), synch = True)
    
    if Dialogs.showLoadingScreen(self.engine, lambda: self.session and self.session.isConnected):
      self.launchLayer(lambda: Lobby(self.engine, self.session, singlePlayer = True))
コード例 #24
0
  def showTutorial(self):
    # evilynux - Make sure tutorial exists before launching
    #tutorialpath = self.engine.getPath(os.path.join("songs","tutorial"))
    tutorialpath = self.engine.tutorialFolder
    if not os.path.isdir(self.engine.resource.fileName(tutorialpath)):
      Log.debug("No folder found: %s" % tutorialpath)
      Dialogs.showMessage(self.engine, _("No tutorials found!"))
      return

    if self.engine.isServerRunning():
      return

    players = Dialogs.activateControllers(self.engine, 1) #akedrou
    if players == 0:
      return
    
    Config.set("game","game_mode", 0)    #MFH - ensure tutorial can work with new logic that depends on this mode variable
    Config.set("game","multiplayer_mode", 0)    #MFH - ensure tutorial can work with new logic that depends on this mode variable
    Config.set("game", "players", 1)
    Config.set("game", "tut", True)
    
    #Config.set("game","game_mode", 1) #MFH - don't force practice mode.... this is problematic.

    self.engine.startServer()
    self.engine.resource.load(self, "session", lambda: self.engine.connect("127.0.0.1"), synch = True)

    if Dialogs.showLoadingScreen(self.engine, lambda: self.session and self.session.isConnected):
      self.launchLayer(lambda: Lobby(self.engine, self.session, singlePlayer = True))
コード例 #25
0
 def help(self):
   Dialogs.showMessage(self.engine, str("Editing keys: ") +
                                    str("Arrows - Move cursor, ") +
                                    str("Space - Play/pause song, ") +
                                    str("Enter - Make note (hold and move for long notes), ") +
                                    str("Delete - Delete note, ") +
                                    str("Page Up/Down - Change difficulty"))
コード例 #26
0
ファイル: MainMenu.py プロジェクト: Gamer125/fofix
 def shown(self):
     self.engine.view.pushLayer(self.menu)
     shaders.checkIfEnabled()
     if not self.shownOnce:
         self.shownOnce = True
         if hasattr(sys, 'frozen'):
             #stump: Check whether this is a non-svn binary being run from an svn working copy.
             if os.path.isdir(os.path.join(
                     'src',
                     '.svn')) and 'development' not in Version.version():
                 Dialogs.showMessage(
                     self.engine,
                     _('This binary release is being run from a Subversion working copy. This is not the correct way to run FoFiX from Subversion. Please see one of the following web pages to set your Subversion working copy up correctly:'
                       ) +
                     '\n\nhttp://code.google.com/p/fofix/wiki/RunningUnderPython26'
                     +
                     '\nhttp://code.google.com/p/fofix/wiki/RequiredSourceModules'
                 )
             #stump: Check whether this is an svn binary not being run from an svn working copy
             elif not os.path.isdir(os.path.join(
                     'src', '.svn')) and 'development' in Version.version():
                 Dialogs.showMessage(
                     self.engine,
                     _('This binary was built from a Subversion working copy but is not running from one. The FoFiX Team will not provide any support whatsoever for this binary. Please see the following site for official binary releases:'
                       ) + '\n\nhttp://code.google.com/p/fofix/')
コード例 #27
0
  def run(self, ticks):
    SceneClient.run(self, ticks)

    if not self.wizardStarted:
      self.wizardStarted = True

      if not self.songName:
        while True:
          self.libraryName, self.songName = \
            Dialogs.chooseSong(self.engine, \
                               selectedLibrary = Config.get("game", "selected_library"),
                               selectedSong    = Config.get("game", "selected_song"))
        
          if not self.songName:
            self.session.world.finishGame()
            return

          Config.set("game", "selected_library", self.libraryName)
          Config.set("game", "selected_song",    self.songName)
          
          info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)
          d = Dialogs.chooseItem(self.engine, info.difficulties,
                                 _("Choose a difficulty:"), selected = self.player.difficulty)
          if d:
            self.player.difficulty = d
            break
      else:
        info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)

      # Make sure the difficulty we chose is available
      if not self.player.difficulty in info.difficulties:
        self.player.difficulty = info.difficulties[0]
        
      self.session.world.deleteScene(self)
      self.session.world.createScene("GuitarScene", libraryName = self.libraryName, songName = self.songName)
コード例 #28
0
    def on_btnApplyClicked(self, widget):

        update_passwd = False

        if self.ui.txtPassword.get_text() != __DUMMY_PASSWORD__:
            update_passwd = True

        user = {
            'login': self._active_user['login'],
            'name': self.ui.txtName.get_text(),
            'password': self.ui.txtPassword.get_text(),
            'confirm': self.ui.txtConfirm.get_text(),
            'groups': self.ui.txtGroups.get_text()
        }
        if not self.validate_user(user):
            return

        #modify user
        try:
            changeuser = serverconf.UsersConf.Users()
            changeuser.set_actiontorun('modify')
            changeuser.set_user(user['login'])
            changeuser.set_name(user['name'])
            if update_passwd:
                cmd = '"openssl" "passwd" "-1" "%s"' % (user['password'])
                args = shlex.split(cmd)
                process = subprocess.Popen(args,
                                           stdout=subprocess.PIPE,
                                           stderr=subprocess.PIPE)
                output, errors = process.communicate()
                changeuser.set_password(output.rstrip())
            changeuser.add_group(user['groups'])

            #avoid to add 2 or more modify entries for the same user
            #add only the last one
            #if there is a create operation, rewrite the create with the modified parameters
            userlist = []
            userinserver = None
            users_conf = self.serverconf.get_users_conf()
            for user2 in users_conf.get_users_list():
                if user2.get_user() == changeuser.get_user():
                    userinserver = user2
                    users_conf.remove_user_from_list(user2)
                    break
            if userinserver != None:
                userinserver.set_name(changeuser.get_name())
                userinserver.set_password(changeuser.get_password())
                userinserver.clear_groups()
                userinserver.add_groups(changeuser.get_groups())
                if userinserver.get_actiontorun() == 'delete':
                    userinserver.set_actiontorun('modify')
                changeuser = userinserver

            users_conf.add_user_to_list(changeuser)
            self.update_user_treeview(changeuser)
            self._select_user()

        except LocalUsersException as e:
            Dialogs.user_error_dialog(e.message)
コード例 #29
0
 def OnAddKW(self, evt):
     """Invoked when the 'Add Keyword to list' button is activated."""
     # Create the Keyword Properties Dialog Box to Add a Keyword
     dlg = KeywordPropertiesForm.AddKeywordDialog(
         self, -1, self.kw_group.GetStringSelection())
     # Set the "continue" flag to True (used to redisplay the dialog if an exception is raised)
     contin = True
     # While the "continue" flag is True ...
     while contin:
         # Get a new Keyword object with properties as given
         kw = dlg.get_input()
         # If the user presses "OK" ...
         if kw != None:
             # Be ready to catch exceptions
             try:
                 # Try to save the keyword
                 kw.db_save()
                 # If the Keyword Group was not changed...
                 if kw.keywordGroup == self.kw_group.GetStringSelection():
                     # ...Add the new Keyword to the Keyword List
                     self.kw_lb.Append(kw.keyword)
                 # If the Keyword Group WAS changed ...
                 else:
                     # ... if the Keyword Group is NOT already in the Keyword Group List ...
                     if self.kw_group.FindString(kw.keywordGroup) == -1:
                         # ... add it to the list.
                         self.kw_group.Append(kw.keywordGroup)
                     # ... and select it.
                     self.kw_group.SetStringSelection(kw.keywordGroup)
                     self.refresh_keywords()
                 if not TransanaConstants.singleUserVersion:
                     if TransanaGlobal.chatWindow != None:
                         msgData = "%s >|< %s" % (kw.keywordGroup,
                                                  kw.keyword)
                         TransanaGlobal.chatWindow.SendMessage("AK %s" %
                                                               msgData)
                 # If we do all this, we don't need to continue any more.
                 contin = False
             # Handle "SaveError" exception
             except SaveError:
                 # Display the Error Message, allow "continue" flag to remain true
                 errordlg = Dialogs.ErrorDialog(None,
                                                sys.exc_info()[1].reason)
                 errordlg.ShowModal()
                 errordlg.Destroy()
             # Handle other exceptions
             except:
                 import traceback
                 traceback.print_exc(file=sys.stdout)
                 # Display the Exception Message, allow "continue" flag to remain true
                 errordlg = Dialogs.ErrorDialog(
                     None,
                     "%s\n%s" % (sys.exc_info()[0], sys.exc_info()[1]))
                 errordlg.ShowModal()
                 errordlg.Destroy()
         # If the user pressed Cancel ...
         else:
             # ... then we don't need to continue any more.
             contin = False
コード例 #30
0
 def setAVDelay(self):
   delay = Dialogs.getText(self.engine, str("Enter A/V delay in milliseconds"), unicode(self.song.info.delay))
   if delay:
     try:
       self.song.info.delay = int(delay)
       self.modified = True
     except ValueError:
       Dialogs.showMessage(self.engine, str("That isn't a number."))
コード例 #31
0
 def setBpm(self):
   bpm = Dialogs.getText(self.engine, str("Enter Beats per Minute Value"), unicode(self.song.bpm))
   if bpm:
     try:
       self.song.setBpm(float(bpm))
       self.modified = True
     except ValueError:
       Dialogs.showMessage(self.engine, str("That isn't a number."))
コード例 #32
0
ファイル: Editor.py プロジェクト: fretsonfire/fof-python
 def setBpm(self):
   bpm = Dialogs.getText(self.engine, _("Enter Beats per Minute Value"), unicode(self.song.bpm))
   if bpm:
     try:
       self.song.setBpm(float(bpm))
       self.modified = True
     except ValueError:
       Dialogs.showMessage(self.engine, _("That isn't a number."))
コード例 #33
0
ファイル: Editor.py プロジェクト: fretsonfire/fof-python
 def setAVDelay(self):
   delay = Dialogs.getText(self.engine, _("Enter A/V delay in milliseconds"), unicode(self.song.info.delay))
   if delay:
     try:
       self.song.info.delay = int(delay)
       self.modified = True
     except ValueError:
       Dialogs.showMessage(self.engine, _("That isn't a number."))
コード例 #34
0
ファイル: Menu.py プロジェクト: twcb/FoF
    def render(self, visibility, topMost):
        if not visibility:
            return

        self.engine.view.setOrthogonalProjection(normalize=True)
        try:
            v = (1 - visibility)**2
            font = self.engine.data.font

            if self.fadeScreen:
                Dialogs.fadeScreen(v)

            glEnable(GL_BLEND)
            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
            glEnable(GL_COLOR_MATERIAL)

            n = len(self.choices)
            x, y = self.pos
            w, h = font.getStringSize("_")

            for i, choice in enumerate(
                    self.choices[self.viewOffset:self.viewOffset +
                                 self.viewSize]):
                text = choice.getText(i + self.viewOffset == self.currentIndex)
                glPushMatrix()
                glRotate(v * 45, 0, 0, 1)

                # Draw arrows if scrolling is needed to see all items
                if i == 0 and self.viewOffset > 0:
                    Theme.setBaseColor(
                        (1 - v) * max(.1, 1 - (1.0 / self.viewOffset) / 3))
                    glPushMatrix()
                    glTranslatef(x - v / 4 - w * 2, y + h / 2, 0)
                    self.renderTriangle(up=(0, -1), s=.015)
                    glPopMatrix()
                elif i == self.viewSize - 1 and self.viewOffset + self.viewSize < n:
                    Theme.setBaseColor((1 - v) * max(
                        .1, 1 - (1.0 /
                                 (n - self.viewOffset - self.viewSize)) / 3))
                    glPushMatrix()
                    glTranslatef(x - v / 4 - w * 2, y + h / 2, 0)
                    self.renderTriangle(up=(0, 1), s=.015)
                    glPopMatrix()

                if i + self.viewOffset == self.currentIndex:
                    a = (math.sin(self.time) * .15 + .75) * (1 - v * 2)
                    Theme.setSelectedColor(a)
                    a *= -.005
                    glTranslatef(a, a, a)
                else:
                    Theme.setBaseColor(1 - v)

                font.render(text, (x - v / 4, y))
                v *= 2
                y += h
                glPopMatrix()
        finally:
            self.engine.view.resetProjection()
コード例 #35
0
ファイル: Editor.py プロジェクト: Gamer125/fofix
    def render(self, visibility, topMost):
        if not self.song:
            return

        v = 1.0 - ((1 - visibility)**2)

        # render the background
        t = self.time / 100 + 34
        w, h, = self.engine.view.geometry[2:4]
        r = .5

        if self.spinnyDisabled != True and Theme.spinnyEditorDisabled:
            self.background.transform.reset()
            self.background.transform.translate(
                w / 2 + math.sin(t / 2) * w / 2 * r,
                h / 2 + math.cos(t) * h / 2 * r)
            self.background.transform.rotate(-t)
            self.background.transform.scale(
                math.sin(t / 8) + 2,
                math.sin(t / 8) + 2)
        self.background.draw()

        self.camera.target = (2, 0, 5.5)
        self.camera.origin = (-2, 9, 5.5)

        glMatrixMode(GL_PROJECTION)
        glLoadIdentity()
        gluPerspective(60, 4.0 / 3.0, 0.1, 1000)
        glMatrixMode(GL_MODELVIEW)
        glLoadIdentity()
        self.camera.apply()
        self.guitar.render(v, self.song, self.scrollPos, self.controls)

        self.engine.view.setOrthogonalProjection(normalize=True)
        font = self.engine.data.font

        try:
            Theme.setSelectedColor()

            w, h = font.getStringSize(" ")

            if self.song.isPlaying():
                status = _("Playing")
            else:
                status = _("Stopped")

            t = "%d.%02d'%03d" % (self.pos / 60000,
                                  (self.pos % 60000) / 1000, self.pos % 1000)
            font.render(t, (.05, .05 - h / 2))
            font.render(status, (.05, .05 + h / 2))
            font.render(unicode(self.song.difficulty[0]),
                        (.05, .05 + 3 * h / 2))

            Theme.setBaseColor()
            text = self.song.info.name + (self.modified and "*" or "")
            Dialogs.wrapText(font, (.5, .05 - h / 2), text)
        finally:
            self.engine.view.resetProjection()
コード例 #36
0
    def on_btnApplyClicked(self, widget):

        update_passwd = False

        if self.ui.txtPassword.get_text() != __DUMMY_PASSWORD__:
            update_passwd = True

        user = {
            'login': self._active_user['login'],
            'name': self.ui.txtName.get_text(),
            'password': self.ui.txtPassword.get_text(),
            'confirm': self.ui.txtConfirm.get_text(),
            'groups': self.ui.txtGroups.get_text()
        }
        if not self.validate_user(user):
            return
        
        #modify user
        try:
            changeuser = serverconf.UsersConf.Users()
            changeuser.set_actiontorun('modify')
            changeuser.set_user(user['login'])
            changeuser.set_name(user['name'])
            if update_passwd:
                cmd = '"openssl" "passwd" "-1" "%s"' % (user['password'])
                args = shlex.split(cmd)
                process = subprocess.Popen(args, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
                output, errors = process.communicate()
                changeuser.set_password(output.rstrip())
            changeuser.add_group(user['groups'])
            
            #avoid to add 2 or more modify entries for the same user
            #add only the last one
            #if there is a create operation, rewrite the create with the modified parameters
            userlist = []
            userinserver = None
            users_conf = self.serverconf.get_users_conf()
            for user2 in users_conf.get_users_list():
                if user2.get_user() == changeuser.get_user():
                    userinserver = user2
                    users_conf.remove_user_from_list(user2)
                    break
            if userinserver != None:
                userinserver.set_name(changeuser.get_name())
                userinserver.set_password(changeuser.get_password())
                userinserver.clear_groups()
                userinserver.add_groups(changeuser.get_groups())
                if userinserver.get_actiontorun() == 'delete':
                    userinserver.set_actiontorun('modify')
                changeuser = userinserver
                
            users_conf.add_user_to_list(changeuser)
            self.update_user_treeview(changeuser)
            self._select_user()

        except LocalUsersException as e:
            Dialogs.user_error_dialog(e.message)
コード例 #37
0
    def _set_keywordGroup(self, keywordGroup):

        # ALSO SEE Dialogs.add_kw_group_ui().  The same errors are caught there.

        # Make sure parenthesis characters are not allowed in Keyword Group.  Remove them if necessary.
        if (string.find(keywordGroup, '(') > -1) or (string.find(
                keywordGroup, ')') > -1):
            keywordGroup = string.replace(keywordGroup, '(', '')
            keywordGroup = string.replace(keywordGroup, ')', '')
            if 'unicode' in wx.PlatformInfo:
                # Encode with UTF-8 rather than TransanaGlobal.encoding because this is a prompt, not DB Data.
                prompt = unicode(
                    _('Keyword Groups cannot contain parenthesis characters.\nYour Keyword Group has been renamed to "%s".'
                      ), 'utf8') % keywordGroup
            else:
                prompt = _(
                    'Keyword Groups cannot contain parenthesis characters.\nYour Keyword Group has been renamed to "%s".'
                ) % keywordGroup
            dlg = Dialogs.ErrorDialog(None, prompt)
            dlg.ShowModal()
            dlg.Destroy()
        # Colons are not allowed in Keyword Groups.  Remove them if necessary.
        if keywordGroup.find(":") > -1:
            keywordGroup = keywordGroup.replace(':', '')
            if 'unicode' in wx.PlatformInfo:
                msg = unicode(
                    _('You may not use a colon (":") in the Keyword Group name.  Your Keyword Group has been changed to\n"%s"'
                      ), 'utf8')
            else:
                msg = _(
                    'You may not use a colon (":") in the Keyword Group name.  Your Keyword Group has been changed to\n"%s"'
                )
            dlg = Dialogs.ErrorDialog(None, msg % keywordGroup)
            dlg.ShowModal()
            dlg.Destroy()
        # Let's make sure we don't exceed the maximum allowed length for a Keyword Group.
        # First, let's see what the max length is.
        maxLen = TransanaGlobal.maxKWGLength
        # Check to see if we've exceeded the max length
        if len(keywordGroup) > maxLen:
            # If so, truncate the Keyword Group
            keywordGroup = keywordGroup[:maxLen]
            # Display a message to the user describing the trunctions
            if 'unicode' in wx.PlatformInfo:
                # Encode with UTF-8 rather than TransanaGlobal.encoding because this is a prompt, not DB Data.
                msg = unicode(
                    _('Keyword Group is limited to %d characters.  Your Keyword Group has been changed to\n"%s"'
                      ), 'utf8')
            else:
                msg = _(
                    'Keyword Group is limited to %d characters.  Your Keyword Group has been changed to\n"%s"'
                )
            dlg = Dialogs.ErrorDialog(None, msg % (maxLen, keywordGroup))
            dlg.ShowModal()
            dlg.Destroy()
        # Remove white space from the Keyword Group.
        self._keywordGroup = Misc.unistrip(keywordGroup)
コード例 #38
0
ファイル: Settings.py プロジェクト: jcemelanda/FretsOnFire
    def applySettings(self):
        for option in self.settingsToApply:
            if isinstance(option, ConfigChoice):
                option.apply()

        Dialogs.showMessage(
            self.engine,
            _("Settings saved. Please restart the game to activate the new settings."
              ))
コード例 #39
0
    def on_btnAddClicked(self, widget):
        login_info = Dialogs.new_user_dialog()

        if login_info == False:
            # Pressed 'Cancel' or dialog closed
            return

        if not self.validate_user(login_info):
            return
        users_conf = self.serverconf.get_users_conf()

        #checking for duplicated users
        usedusers = set()
        createdusers = {}
        removeusers = []
        for user in self.read_users():
            usedusers.add(user['login'])
            createdusers[user['login']] = user
        for user in users_conf.get_users_list():
            if user.get_actiontorun() == 'create':
                usedusers.add(user.get_user())
            elif user.get_actiontorun() == 'delete':
                removeusers.append(user)
                usedusers.remove(user.get_user())
        if login_info['login'] in usedusers:
            Dialogs.user_error_dialog(_('Duplicated user'))
            return

        #mark to add
        try:
            newuser = serverconf.UsersConf.Users()
            newuser.set_actiontorun('create')
            newuser.set_user(login_info['login'])
            newuser.set_name(login_info['name'])
            cmd = '"openssl" "passwd" "-1" "%s"' % (login_info['password'])
            args = shlex.split(cmd)
            process = subprocess.Popen(args,
                                       stdout=subprocess.PIPE,
                                       stderr=subprocess.PIPE)
            output, errors = process.communicate()
            newuser.set_password(output.rstrip())
            for user in removeusers:
                if newuser.get_user() == user.get_user():
                    if newuser.get_user() in createdusers.keys():
                        newuser.set_actiontorun('modify')
                        groups = createdusers[
                            newuser.get_user()]['groups'].split(' ')
                        newuser.add_groups(groups)
                    users_conf.remove_user_from_list(user)
            users_conf.add_user_to_list(newuser)

            self.add_user_treeview(newuser)
            self._select_user()

        except LocalUsersException as e:
            Dialogs.user_error_dialog(e.message)
コード例 #40
0
ファイル: InitWindow.py プロジェクト: dotaky99/PreAnalyzer
 def buttonFunction(self):
     dlg = Dialogs.MemoryDialog()
     dlg.exec_()
     file = Dialogs.FileCopy()
     file.exec_()
     file2 = Dialogs.Parsing()
     file2.exec_()
     self.hide()
     self.window2 = SecondWindow.MainWindow()
     self.window2.show()
コード例 #41
0
ファイル: MainMenu.py プロジェクト: Gamer125/fofix
 def harness(self, *args, **kwargs):
   try:
     try:
       function(self, *args, **kwargs)
     except:
       import traceback
       traceback.print_exc()
       raise
   except socket.error, e:
     Dialogs.showMessage(self.engine, unicode(e[1]))
コード例 #42
0
ファイル: MainMenu.py プロジェクト: Gamer125/fofix
 def harness(self, *args, **kwargs):
     try:
         try:
             function(self, *args, **kwargs)
         except:
             import traceback
             traceback.print_exc()
             raise
     except socket.error, e:
         Dialogs.showMessage(self.engine, unicode(e[1]))
コード例 #43
0
ファイル: SongChoosingScene.py プロジェクト: cherbib/fofix
 def loadLibrary(self):
   Log.debug("Loading libraries in %s" % self.library)
   self.loaded = False
   self.tiersPresent = False
   if self.splash:
     Dialogs.changeLoadingSplashScreenText(self.engine, self.splash, _("Browsing Collection..."))
   else:
     self.splash = Dialogs.showLoadingSplashScreen(self.engine, _("Browsing Collection..."))
     self.loadStartTime = time.time()
   self.engine.resource.load(self, "libraries", lambda: Song.getAvailableLibraries(self.engine, self.library), onLoad = self.loadSongs, synch = True)
コード例 #44
0
    def on_btnAddClicked(self, widget):
        login_info = Dialogs.new_user_dialog()


        if login_info == False:
            # Pressed 'Cancel' or dialog closed
            return

        if not self.validate_user(login_info):
            return
        users_conf = self.serverconf.get_users_conf()

        #checking for duplicated users
        usedusers = set()
        createdusers = {}
        removeusers = []
        for user in self.read_users():
            usedusers.add(user['login'])
            createdusers[user['login']] = user
        for user in users_conf.get_users_list():
            if user.get_actiontorun() == 'create':
                usedusers.add(user.get_user())
            elif user.get_actiontorun() == 'delete':
                removeusers.append(user)
                usedusers.remove(user.get_user())
        if login_info['login'] in usedusers:
            Dialogs.user_error_dialog(_('Duplicated user'))
            return
        
        #mark to add
        try:
            newuser = serverconf.UsersConf.Users()
            newuser.set_actiontorun('create')
            newuser.set_user(login_info['login'])
            newuser.set_name(login_info['name'])
            cmd = '"openssl" "passwd" "-1" "%s"' % (login_info['password'])
            args = shlex.split(cmd)
            process = subprocess.Popen(args, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
            output, errors = process.communicate()
            newuser.set_password(output.rstrip())
            for user in removeusers:
                if newuser.get_user() == user.get_user():
                    if newuser.get_user() in createdusers.keys():
                        newuser.set_actiontorun('modify')
                        groups = createdusers[newuser.get_user()]['groups'].split(' ')
                        newuser.add_groups(groups)
                    users_conf.remove_user_from_list(user)
            users_conf.add_user_to_list(newuser)

            self.add_user_treeview(newuser)
            self._select_user()
            

        except LocalUsersException as e:
            Dialogs.user_error_dialog(e.message)
コード例 #45
0
ファイル: GameEngine.py プロジェクト: fofix/fof-reborn
    def loading(self):
        """Loading state loop."""

        if self.data.essentialResourcesLoaded():
            if not self.loadingScreenShown:
                self.loadingScreenShown = True
                Dialogs.showLoadingScreen(self, self.data.resourcesLoaded)
                if self.startupLayer:
                    self.view.pushLayer(self.startupLayer)
                self.mainloop = self.main
            self.view.render()
コード例 #46
0
ファイル: __init__.py プロジェクト: ahdiaz/gecos-firstboot
    def on_btnRemoveClicked(self, widget):
        action = Dialogs.remove_user_dialog(self._active_user)
        if action == False:
            return

        try:
            SystemUsers.remove_user(self._active_user['login'], action[1])
            self.reload_page()

        except SystemUsers.SystemUserException as e:
            Dialogs.user_error_dialog(e.message)
コード例 #47
0
ファイル: MainMenu.py プロジェクト: maggotgdv/fofix
    def showTutorial(self):
        # evilynux - Make sure tutorial exists before launching
        tutorialpath = self.engine.tutorialFolder
        if not os.path.isdir(self.engine.resource.fileName(tutorialpath)):
            Log.debug("No folder found: %s" % tutorialpath)
            Dialogs.showMessage(self.engine, _("No tutorials found!"))
            return

        self.engine.startWorld(1, None, 0, 0, tutorial = True)

        self.launchLayer(lambda: Lobby(self.engine))
コード例 #48
0
ファイル: MainMenu.py プロジェクト: zelurker/fofix
  def joinMultiplayerGame(self, address = None):
    if not address:
      address = Dialogs.getText(self.engine, _("Enter the server address:"), "127.0.0.1")

    if not address:
      return
    
    self.engine.resource.load(self, "session", lambda: self.engine.connect(address))

    if Dialogs.showLoadingScreen(self.engine, lambda: self.session and self.session.isConnected, text = _("Connecting...")):
      self.launchLayer(lambda: Lobby(self.engine, self.session))
コード例 #49
0
ファイル: MainMenu.py プロジェクト: donut87/fofix
    def showTutorial(self):
        # evilynux - Make sure tutorial exists before launching
        tutorialpath = self.engine.tutorialFolder
        if not os.path.isdir(self.engine.resource.fileName(tutorialpath)):
            Log.debug("No folder found: %s" % tutorialpath)
            Dialogs.showMessage(self.engine, _("No tutorials found!"))
            return

        self.engine.startWorld(1, None, 0, 0, tutorial = True)

        self.launchLayer(lambda: Lobby(self.engine))
コード例 #50
0
  def joinMultiplayerGame(self, address = None):
    if not address:
      address = Dialogs.getText(self.engine, _("Enter the server address:"), "127.0.0.1")

    if not address:
      return
    
    self.engine.resource.load(self, "session", lambda: self.engine.connect(address))

    if Dialogs.showLoadingScreen(self.engine, lambda: self.session and self.session.isConnected, text = _("Connecting...")):
      self.launchLayer(lambda: Lobby(self.engine, self.session))
コード例 #51
0
ファイル: Menu.py プロジェクト: fretsonfire/fof-python
  def render(self, visibility, topMost):
    if not visibility:
      return

    self.engine.view.setOrthogonalProjection(normalize = True)
    try:
      v = (1 - visibility) ** 2
      font = self.engine.data.font

      if self.fadeScreen:
        Dialogs.fadeScreen(v)
      
      glEnable(GL_BLEND)
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
      glEnable(GL_COLOR_MATERIAL)

      n = len(self.choices)
      x, y = self.pos
      w, h = font.getStringSize("_")

      for i, choice in enumerate(self.choices[self.viewOffset:self.viewOffset + self.viewSize]):
        text = choice.getText(i + self.viewOffset == self.currentIndex)
        glPushMatrix()
        glRotate(v * 45, 0, 0, 1)

        # Draw arrows if scrolling is needed to see all items
        if i == 0 and self.viewOffset > 0:
          Theme.setBaseColor((1 - v) * max(.1, 1 - (1.0 / self.viewOffset) / 3))
          glPushMatrix()
          glTranslatef(x - v / 4 - w * 2, y + h / 2, 0)
          self.renderTriangle(up = (0, -1), s = .015)
          glPopMatrix()
        elif i == self.viewSize - 1 and self.viewOffset + self.viewSize < n:
          Theme.setBaseColor((1 - v) * max(.1, 1 - (1.0 / (n - self.viewOffset - self.viewSize)) / 3))
          glPushMatrix()
          glTranslatef(x - v / 4 - w * 2, y + h / 2, 0)
          self.renderTriangle(up = (0, 1), s = .015)
          glPopMatrix()

        if i + self.viewOffset == self.currentIndex:
          a = (math.sin(self.time) * .15 + .75) * (1 - v * 2)
          Theme.setSelectedColor(a)
          a *= -.005
          glTranslatef(a, a, a)
        else:
          Theme.setBaseColor(1 - v)

        font.render(text, (x - v / 4, y))
        v *= 2
        y += h
        glPopMatrix()
    finally:
      self.engine.view.resetProjection()
コード例 #52
0
ファイル: GameResultsScene.py プロジェクト: Gamer125/fofix
  def keyPressed(self, key, unicode):
    ret = SceneClient.keyPressed(self, key, unicode)

    c = self.controls.keyPressed(key)
    if self.song and (c in [Player.KEY1, Player.KEY2, Player.CANCEL, Player.ACTION1, Player.ACTION2, Player.DRUM1A, Player.DRUM4A] or key == pygame.K_RETURN):
      for i,player in enumerate(self.playerList):
      
        scores = self.song.info.getHighscores(player.difficulty, part = player.part)
        if not scores or player.score > scores[-1][0] or len(scores) < 5:
          if player.cheating:
            Dialogs.showMessage(self.engine, _("No highscores for cheaters!"))
          elif player.score == 0: #trinidude4
            Dialogs.showMessage(self.engine, _("No highscore")) #trinidude4
          else:
            #alarian name = Dialogs.getText(self.engine, _("%d points is a new high score! Player " + str(i+1) + " enter your name") % player.score, player.name)
            name = Dialogs.getText(self.engine, _("%d points is a new high score! Enter your name") % player.score, player.name)
            if name:
              player.name = name

            #myfingershurt: don't separate chords for drum part totals:
            if player.part.text == "Drums":
              notesTotal = len([1 for time, event in self.song.track[i].getAllEvents() if isinstance(event, Song.Note)])
            else:
              notesTotal = len(set(time for time, event in self.song.track[i].getAllEvents() if isinstance(event, Song.Note)))
              
            modOptions1 = self.engine.config.getModOptions1(player.twoChord, 0)
            modOptions2 = self.engine.config.getModOptions2()
            scoreExt = (player.notesHit, notesTotal, player.longestStreak, Version.branchVersion(), modOptions1, modOptions2)
            self.highscoreIndex[i] = self.song.info.addHighscore(player.difficulty, player.score, self.stars[i], player.name, part = player.part, scoreExt = scoreExt)
            self.song.info.save()
          
            if self.engine.config.get("game", "uploadscores") and not player.cheating:
              self.uploadingScores = True
              #myfingershurt: ensuring new SP highscore upload URL is used from Divra (set to default in gameengine.py)
              # evilynux - New url starting 20080902
              fn = lambda: self.song.info.uploadHighscores(self.engine.config.get("game", "uploadurl_w67_starpower"), self.song.getHash(), part = player.part)
              
              self.engine.resource.load(self, "uploadResult", fn)

      if len(self.playerList) > 1 and self.playerList[0].part == self.playerList[1].part and self.playerList[0].difficulty == self.playerList[1].difficulty and self.highscoreIndex[0] != -1 and self.highscoreIndex[1] != -1 and self.highscoreIndex[1] <= self.highscoreIndex[0]:
        self.highscoreIndex[0] += 1
      
      if self.song.info.count:
        count = int(self.song.info.count)
      else:
        count = 0
      count += 1
      self.song.info.count = "%d" % count
      self.song.info.save()
      self.showHighscores = True
      self.engine.view.pushLayer(self.menu)
      return True
    return ret
コード例 #53
0
 def resetWorld(self):
     if self.scene:
         self.engine.view.popLayer(self.scene)
         self.engine.removeTask(self.scene)
     for layer in self.engine.view.layers:
         if isinstance(layer, Dialogs.LoadingSplashScreen):
             Dialogs.hideLoadingSplashScreen(self.engine, layer)
     self.scene = None
     self.sceneName = ""
     self.players = []
     self.songQueue.reset()
     self.engine.mainMenu.restartGame()
コード例 #54
0
ファイル: Editor.py プロジェクト: fretsonfire/fof-python
  def shown(self):
    self.engine.input.addKeyListener(self)

    if not self.songName:
      self.libraryName, self.songName = Dialogs.chooseSong(self.engine)

    if not self.songName:
      self.engine.view.popLayer(self)
      return

    self.engine.resource.load(self, "song", lambda: loadSong(self.engine, self.songName, seekable = True, library = self.libraryName))
    Dialogs.showLoadingScreen(self.engine, lambda: self.song, text = _("Loading song..."))