Beispiel #1
0
 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/')
 def loadIcons(self):
     #begin to load images...
     self.itemIcons = {}
     if os.path.isdir(os.path.join(Version.dataPath(),"themes",self.themename,"setlist")):
         self.engine.data.loadAllImages(self, os.path.join("themes",self.themename,"setlist"))
         if os.path.isdir(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","icon")):
             self.itemIcons = self.engine.data.loadAllImages(None, os.path.join("themes",self.themename,"setlist","icon"), prefix="")
Beispiel #3
0
def setupWindows():
  setup(#stump: these arguments interfere with the version tagging code,
        #  but they don't really do anything important anyway.  When the
        #  version tagging code was modified, they suddenly became a valid
        #  source of info for py2exe to synthesize a version info resource
        #  of its own, which supersedes the one specified further down.
        #version = Version.VERSION,
        #description = "Rockin' it Oldskool!",
        #name = Version.appNameSexy(),
        #url = Version.URL,
        windows = [
          {
            "script":          "FretsOnFire.py",
            "icon_resources":  [(1, "fof.ico")],
            "other_resources": [(RT_VERSION, 1, VersionResource(
              #stump: the parameter below must consist only of up to four numerical fields separated by dots
              Version.VERSION,
              file_description="Frets on Fire X",
              legal_copyright=r"© 2008-2009 FoFiX Team.  GNU GPL v2 or later.",
              company_name="FoFiX Team",
              internal_name="FretsOnFire.exe",
              original_filename="FretsOnFire.exe",
              product_name=Version.appNameSexy(),
              #stump: when run from the exe, FoFiX will claim to be "FoFiX v" + product_version
              product_version=Version.version()
            ).resource_bytes())]
          }
        ],
        zipfile = "data/library.zip",
        data_files = dataFiles,
        options = options)
Beispiel #4
0
def setupWindows():
    setup(  #stump: these arguments interfere with the version tagging code,
        #  but they don't really do anything important anyway.  When the
        #  version tagging code was modified, they suddenly became a valid
        #  source of info for py2exe to synthesize a version info resource
        #  of its own, which supersedes the one specified further down.
        #version = Version.VERSION,
        #description = "Rockin' it Oldskool!",
        #name = Version.appNameSexy(),
        #url = Version.URL,
        windows=[{
            "script":
            "FoFiX.py",
            "icon_resources": [(1, "fofix.ico")],
            "other_resources": [(
                RT_VERSION,
                1,
                VersionResource(
                    #stump: the parameter below must consist only of up to four numerical fields separated by dots
                    Version.VERSION,
                    file_description="Frets on Fire X",
                    legal_copyright=
                    r"© 2008-2009 FoFiX Team.  GNU GPL v2 or later.",
                    company_name="FoFiX Team",
                    internal_name="FoFiX.exe",
                    original_filename="FoFiX.exe",
                    product_name=Version.appNameSexy(),
                    #stump: when run from the exe, FoFiX will claim to be "FoFiX v" + product_version
                    product_version=Version.version()).resource_bytes())]
        }],
        zipfile="data/library.zip",
        data_files=dataFiles,
        options=options)
Beispiel #5
0
 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})
Beispiel #6
0
 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})
Beispiel #7
0
    def start(self):
        start = time.time()
        print("--> Starting build of the main code base")
        print("--> Build configuration " + Globals.build_target_ + " : " +
              Globals.build_parameters_)
        print("--> Operating System: " + Globals.operating_system_)

        self.cmake_compiler_ = Globals.cmake_compiler_  #[ 'Unix', 'MinGW' ][ Globals.operating_system_ == "windows" ]
        print("--> CMake Compiler: " + Globals.cmake_compiler_)

        # Check to see if the third party libraries have been built
        third_party_dir = "bin/" + Globals.operating_system_ + "_" + Globals.compiler_ + "/thirdparty"
        if not os.path.exists(third_party_dir):
            return Globals.PrintError(
                "Third party libraries have not been built. Please build these first with thirdparty argument"
            )

        ## Build Version.h
        version = Version()
        version.create_version_header()

        self.output_directory_ = "bin/" + Globals.operating_system_ + "_" + Globals.compiler_ + "/" + Globals.build_target_
        cmake_os_path = Globals.operating_system_ + "_" + Globals.compiler_

        if Globals.build_parameters_ != "":
            self.output_directory_ += "_" + Globals.build_parameters_

        if not os.path.exists(self.output_directory_):
            os.makedirs(self.output_directory_)
        print("--> Target output directory: " + self.output_directory_)

        os.chdir(self.output_directory_)

        if Globals.build_target_.upper(
        ) == "TEST":  # Handle new keyword TEST in CMake v3
            Globals.build_target_ = "TESTMODE"

        print('--> Preparing CMake command')
        build_string = 'cmake ' + self.cmake_compiler_ + ' -D' + Globals.build_target_.upper(
        ) + '=1'
        if Globals.build_parameters_ != "":
            build_string += ' -D' + Globals.build_parameters_.upper() + '=1'
        build_string += ' ../../..'

        print("--> CMake command: " + build_string)
        if os.system(build_string) != EX_OK:
            return Globals.PrintError(
                "Failed to execute cmake successfully to rebuild the make files"
            )

        print("--> Build main code base")
        if os.system(Globals.make_command_) != EX_OK:
            return Globals.PrintError(
                "Failed to build code base. Please see above for build error")

        elapsed = time.time() - start
        print('Compile finished in ' + str(round(elapsed, 2)) + ' seconds')
        return True
 def __about(self):
     versionStr='3.6.0'    
     revisionStr='0'
 
     try:
         import Version            
         versionStr=Version.getVersionAsString()    
         revisionStr=Version.getSVNRevisionAsString()    
     except ImportError,e:
         pass
Beispiel #9
0
    def __about(self):
        versionStr = '3.6.0'
        revisionStr = '0'

        try:
            import Version

            versionStr = Version.getVersionAsString()
            revisionStr = Version.getSVNRevisionAsString()
        except ImportError, e:
            pass
Beispiel #10
0
  def debugOut(self, engine):
    f = open("debug.txt", "w+")
    version = Version.version()
    currentDir = os.getcwd()
    dataDir = Version.dataPath()
    translationDir = dataDir + "/translations"
    modsDir = dataDir + "/mods"

    f.write("Date = %s\n" % datetime.datetime.now())   
    f.write("\nVersion = %s\n" %  version)
    f.write("\nOS = %s\n" % os.name)

    f.write("\nCurrent Directory = %s\n" % currentDir)
    self.directoryList(f, currentDir)

    f.write("\nData Directory = %s\n" % dataDir)
    self.directoryList(f, dataDir)

    f.write("\nLibrary.zip\n")
    zip = zipfile.ZipFile(dataDir + "/library.zip", 'r')
    for info in zip.infolist():
      fileName = info.filename
      fileCSize = info.compress_size
      fileSize = info.file_size
      fileDate = datetime.datetime(*(info.date_time))
      f.write("%s, %s, %s, %s\n" % (fileName, fileCSize, fileSize, fileDate))

    
    f.write("\nTranslation Directory = %s\n" % translationDir)
    self.directoryList(f, translationDir)
    
    f.write("\nMods Directory = %s\n" % modsDir)
    self.directoryList(f, modsDir)

    mods = os.listdir(modsDir)

    for mod in mods:
      modDir = os.path.join(modsDir, mod)
      if os.path.isdir(modDir):
        f.write("\nMod Directory = %s\n" % modDir)
        self.directoryList(f, modDir)

    f.write("\nFretsonfire.ini\n")   
    engine.config.config.write(f)

    f.write("\nTheme.ini\n")   
    Theme.write(f, engine.config)

    f.write("\nStage.ini\n")
    stage = Stage.Stage(self, self.engine.resource.fileName("stage.ini"))
    stage.config.write(f)
    f.close()
Beispiel #11
0
  def debugOut(self, engine):
    f = open("debug.txt", "w+")
    version = Version.version()
    currentDir = os.getcwd()
    dataDir = Version.dataPath()
    translationDir = dataDir + "/translations"
    modsDir = dataDir + "/mods"

    f.write("Date = %s\n" % datetime.datetime.now())   
    f.write("\nVersion = %s\n" %  version)
    f.write("\nOS = %s\n" % os.name)

    f.write("\nCurrent Directory = %s\n" % currentDir)
    self.directoryList(f, currentDir)

    f.write("\nData Directory = %s\n" % dataDir)
    self.directoryList(f, dataDir)

    f.write("\nLibrary.zip\n")
    zip = zipfile.ZipFile(dataDir + "/library.zip", 'r')
    for info in zip.infolist():
      fileName = info.filename
      fileCSize = info.compress_size
      fileSize = info.file_size
      fileDate = datetime.datetime(*(info.date_time))
      f.write("%s, %s, %s, %s\n" % (fileName, fileCSize, fileSize, fileDate))

    
    f.write("\nTranslation Directory = %s\n" % translationDir)
    self.directoryList(f, translationDir)
    
    f.write("\nMods Directory = %s\n" % modsDir)
    self.directoryList(f, modsDir)

    mods = os.listdir(modsDir)

    for mod in mods:
      modDir = os.path.join(modsDir, mod)
      if os.path.isdir(modDir):
        f.write("\nMod Directory = %s\n" % modDir)
        self.directoryList(f, modDir)

    f.write("\nFretsonfire.ini\n")   
    engine.config.config.write(f)

    f.write("\nTheme.ini\n")   
    Theme.write(f, engine.config)

    f.write("\nStage.ini\n")
    stage = Stage.Stage(self, self.engine.resource.fileName("stage.ini"))
    stage.config.write(f)
    f.close()
Beispiel #12
0
    def __init__(self, parent):
        wx.Dialog.__init__(self, parent, -1, u"关于...",
                           style = wx.BORDER_DOUBLE, size = (500, 260)
                           )
        bmp = wx.StaticBitmap(self, -1, Resource.ui_banner)
        panel = wx.Panel(self)
        panel.SetBackgroundColour('#B3B2B3')
        
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(bmp, 0)
        sizer.Add(panel, 1, flag = wx.EXPAND)
        
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(sizer, 0, flag = wx.EXPAND)
        
        font = wx.Font(16, wx.FONTFAMILY_SWISS, wx.BOLD, wx.NORMAL)

        #Get hav-gclient version
        version = Version.string('python-hav-gclient', 3)
        #label = wx.StaticText(self, -1, 'hav-gclient: %s' %(version))
        label = wx.StaticText(self, -1, '客户端: %s' %(version))
        label.SetFont(font)
        mainSizer.AddSpacer(30)
        mainSizer.Add(label, 0, flag = wx.ALIGN_CENTER_HORIZONTAL)
        mainSizer.AddSpacer(10)
        #label = wx.StaticText(self, -1, u'2014-01-08')

        #versionSpice = Version.string('spice-gtk', 2)
        versionVirtViewer = Version.string('virt-viewer', 2)
        
        #label = wx.StaticText(self, -1, 'SC-client: %s' %(versionVirtViewer))
        label = wx.StaticText(self, -1, '协议: %s' %(versionVirtViewer))
        mainSizer.Add(label, 0, flag = wx.ALIGN_CENTER_HORIZONTAL)
        
        mainSizer.AddSpacer(20)
        
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        
        btn_ok = wx.Button(self, wx.ID_OK, u'确定')
        
        sizer.Add(btn_ok, 0, flag = wx.ALIGN_CENTER_HORIZONTAL)
        sizer.AddSpacer(100)
        btn_update = wx.Button(self, -1, u'检查更新')
        self.Bind(wx.EVT_BUTTON, self.OnUpdate, btn_update)
        
        sizer.Add(btn_update, 0, flag = wx.ALIGN_CENTER_HORIZONTAL)

        mainSizer.AddSpacer(10)
        mainSizer.Add(sizer, 0, flag = wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL)
        
        self.SetSizer(Util.CreateCenterSizer(mainSizer, 10))
 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/')
Beispiel #14
0
    def __init__(self, guitarScene, configFileName, coOp=False):

        self.scene = guitarScene
        self.engine = guitarScene.engine
        self.layers = {}  #collection of all the layers in the rockmeter
        self.layersForRender = {
        }  #collection of layers that are rendered separate from any group
        self.layerGroups = {}  #collection of layer groups
        self.sharedLayerGroups = {}
        self.sharedLayers = {}  #these layers are for coOp use only
        self.sharedLayersForRender = {}
        self.sharedGroups = {}

        self.coOp = coOp
        self.config = LinedConfigParser()
        self.config.read(configFileName)

        self.themename = self.engine.data.themeLabel

        try:
            themepath = os.path.join(Version.dataPath(), "themes",
                                     self.themename)
            fp, pathname, description = imp.find_module(
                "CustomRMLayers", [themepath])
            self.customRMLayers = imp.load_module("CustomRMLayers", fp,
                                                  pathname, description)
        except ImportError:
            self.customRMLayers = None
            Log.notice("Custom Rockmeter layers are not available")

        # Build the layers
        for i in range(Rockmeter._layerLimit):
            types = ["Image", "Text", "Circle", "Custom"]

            for t in types:
                self.section = "layer%d:%s" % (i, t)
                if not self.config.has_section(self.section):
                    continue
                else:
                    if t == types[1]:
                        self.createFont(self.section, i)
                    elif t == types[2]:
                        self.createCircle(self.section, i)
                    elif t == types[3]:
                        self.createCustom(self.section, i)
                    else:
                        self.createImage(self.section, i)
                    break

        for i in range(Rockmeter._groupLimit):
            self.section = "Group%d" % i
            if not self.config.has_section(self.section):
                continue
            else:
                self.createGroup(self.section, i)

        print self.layerGroups
        print self.sharedLayerGroups
        print self.layersForRender
        self.reset()
Beispiel #15
0
def setupWindows():
    setup(
        version=Version.version(),
        description="Rockin' it Oldskool!",
        name="Frets on Fire",
        url="http://www.unrealvoodoo.org",
        windows=[{
            "script":
            "FretsOnFire.py",
            "icon_resources": [(1, "fof.ico")],
            "other_resources": [(
                RT_VERSION,
                1,
                VersionResource(
                    #stump: the parameter below must consist only of up to four numerical fields separated by dots
                    fullVersionString[
                        7:12],  # extract "x.yyy" from "FoFiX vx.yyy ..."
                    file_description="Frets on Fire X",
                    legal_copyright=
                    r"© 2008-2009 FoFiX Team.  GNU GPL v2 or later.",
                    company_name="FoFiX Team",
                    internal_name="FretsOnFire.exe",
                    original_filename="FretsOnFire.exe",
                    product_name="FoFiX",
                    #stump: when run from the exe, FoFiX will claim to be "FoFiX v" + product_version
                    product_version=fullVersionString[
                        7:]  # remove "FoFiX v" from front
                ).resource_bytes())]
        }],
        zipfile="data/library.zip",
        data_files=dataFiles,
        options=options)
Beispiel #16
0
	def createBuildVersion(env, target, project) :
		buildVersion = """#pragma once

static const char* buildVersion = \"%(buildVersion)s\";\n
#define SWIFT_VERSION_STRING \"%(buildVersion)s\";\n
""" % { "buildVersion" : Version.getBuildVersion(env.Dir("#").abspath, project) }
		env.WriteVal(target, env.Value(buildVersion))
Beispiel #17
0
    def verify(self):
        """ Check whether the license file is integral; cnippet's version applies;
            and license has not expired.
        """

        secret = '$*we#j238@#WA!%'
        h = hashlib.sha1()
        h.update(secret[10:12])
        h.update(base64.b64encode(self.product))
        h.update(secret[1:4])
        h.update(self.version[0])
        h.update(secret[6:9])
        h.update(self.email)
        h.update(self.expiration)
        digest = h.hexdigest()

        # If the hash doesn't match, data has been corrupted.
        if self.key != digest:
            sys.exit(DiagnosticReporter.fatal(CORRUPTED_LICENSE_FILE))

        # Verify product version.
        if int(self.version[0]) != Version().major:
            sys.exit(
                DiagnosticReporter.fatal(INCOMPATIBLE_LICENSE_PRODUCT_VERSION))

        # Verify expiration.
        exp_date = datetime.datetime.strptime(self.expiration, '%d/%B/%Y')
        if datetime.datetime.today() > exp_date:
            sys.exit(DiagnosticReporter.fatal(LICENSE_EXPIRED))
Beispiel #18
0
 def fetch_versions_for_shot(self, m_shot_obj):
     ver_ret = []
     filters = [
         ['project', 'is', {'type' : 'Project', 'id' : int(self.g_shotgun_project_id)}],
         ['entity', 'is', {'type' : 'Shot', 'id' : int(m_shot_obj.g_dbid)}]
     ]
     fields = ['code', 'id', 'description', 'sg_first_frame', 'sg_last_frame', 'frame_count', 'sg_path_to_frames', 'sg_path_to_movie', 'entity', 'user', 'sg_task', 'sg_delivered', 'client_code', 'playlists', 'sg_path_to_matte_frames', 'sg_matte_ready_', 'sg_matte_delivered_']
     sg_vers = self.g_sg.find("Version", filters, fields)
     if not sg_vers:
         return ver_ret
     else:
         for sg_ver in sg_vers:
             local_artist = self.fetch_artist_from_id(int(sg_ver['user']['id']))
             tmp_ver = Version.Version(sg_ver['code'], sg_ver['id'], sg_ver['description'], sg_ver['sg_first_frame'], sg_ver['sg_last_frame'], sg_ver['frame_count'], sg_ver['sg_path_to_frames'], sg_ver['sg_path_to_movie'], m_shot_obj, local_artist, None)
             tmp_delivered = False
             if sg_ver['sg_delivered'] == 'True':
                 tmp_delivered = True
             tmp_ver.set_delivered(tmp_delivered)
             tmp_ver.set_client_code(sg_ver['client_code'])
             tmp_playlists = []
             for tmp_pl_struct in sg_ver['playlists']:
                 tmp_playlists.append(Playlist.Playlist(tmp_pl_struct['name'], [], tmp_pl_struct['id']))
             tmp_ver.set_playlists(tmp_playlists)
             if sg_ver['sg_path_to_matte_frames']:
                 tmp_ver.set_path_to_matte_frames(sg_ver['sg_path_to_matte_frames'])
             if sg_ver['sg_matte_ready_'] == 'True':
                 tmp_ver.set_matte_ready(True)
             if sg_ver['sg_matte_delivered_'] == 'True':
                 tmp_ver.set_matte_delivered(True)
             ver_ret.append(tmp_ver)
         return ver_ret
Beispiel #19
0
def setupWindows():
  setup(version = Version.version(),
        description = "Rockin' it Oldskool!",
        name = "Frets on Fire",
        url = "http://www.unrealvoodoo.org",
        windows = [
          {
            "script":          "FretsOnFire.py",
            "icon_resources":  [(1, "fof.ico")],
            "other_resources": [(RT_VERSION, 1, VersionResource(
              #stump: the parameter below must consist only of up to four numerical fields separated by dots
              fullVersionString[7:12],  # extract "x.yyy" from "FoFiX vx.yyy ..."
              file_description="Frets on Fire X",
              legal_copyright=r"© 2008-2009 FoFiX Team.  GNU GPL v2 or later.",
              company_name="FoFiX Team",
              internal_name="FretsOnFire.exe",
              original_filename="FretsOnFire.exe",
              product_name="FoFiX",
              #stump: when run from the exe, FoFiX will claim to be "FoFiX v" + product_version
              product_version=fullVersionString[7:]  # remove "FoFiX v" from front
            ).resource_bytes())]
          }
        ],
        zipfile = "data/library.zip",
        data_files = dataFiles,
        options = options)
  def createBuildVersion(env, target, project) :
    buildVersion = """#pragma once

static const char* buildVersion = \"%(buildVersion)s\";\n
#define SWIFT_VERSION_STRING \"%(buildVersion)s\";\n
""" % { "buildVersion" : Version.getBuildVersion(project) }
    env.WriteVal(target, env.Value(buildVersion))
Beispiel #21
0
    def saveAsXML(self, _fileName):
        print '_fileName=',_fileName
        import XMLUtils
        from XMLUtils import ElementCC3D
        import Version
        xml2ObjConverter = XMLUtils.Xml2Obj()
        plSetElem = ElementCC3D('PlayerSettings',{'version':Version.getVersionAsString()})
        # print '\n\n\nself.__typeSettingDictDict.keys() = ', self.__typeSettingDictDict.keys()
        # print '__typeSettingDictDict=',self.__typeSettingDictDict
        for typeName , settingDict in self.__typeSettingDictDict.iteritems():

            typeContainerElem = plSetElem.ElementCC3D( 'Settings', {'Type':typeName} )
            # print 'typeName=',typeName
            # if typeName =='FieldParams':
            #     print 'typeName=',typeName, ' settingDict=',settingDict

            for settingName, setting in sorted(settingDict.iteritems()):  # keys are sorted before outputting to XML
                # if settingName=='ShowPlotAxes':
                #
                #     try:
                #         print 'settingName=', settingName, ' setting=', setting, 'typeContainerElem=',typeName
                #     except:
                #         pass

                setting.toXML(typeContainerElem)

        fileFullPath = os.path.abspath(_fileName)
        plSetElem.CC3DXMLElement.saveXML(fileFullPath)
 def __init__(self, portnum = None, *args, **kwargs):
     Notifications.Notifier.__init__(self, *args, **kwargs)
     self._portnum = portnum
     self._swversion =  Version.getRevision()
     self._fwversion = 0
     self._setState(STATE_INITIALIZING)
     self._captureHandler = CaptureFiles.CaptureFileHandler()
     self._exit = False
     self._connectionAccessAddress = None
     self._packetListLock = threading.RLock()
     with self._packetListLock:
         self._packets = []
         
     self._packetReader = Packet.PacketReader(self._portnum,  callbacks=[("*", self.passOnNotification)])
     self._devices = Devices.DeviceList(callbacks=[("*", self.passOnNotification)])
     
     self._missedPackets = 0
     self._packetsInLastConnection = None
     self._connectEventPacketCounterValue = None
     self._inConnection = False
     self._currentConnectRequest = None
     
     self._nProcessedPackets = 0
     
     self._switchingBaudRate = False
     
     self._attemptedBaudRates = []
     
     
     self._boardId = self._makeBoardId()
Beispiel #23
0
    def __init__(self, portnum=None, *args, **kwargs):
        Notifications.Notifier.__init__(self, *args, **kwargs)
        self._portnum = portnum
        self._swversion = Version.getRevision()
        self._fwversion = 0
        self._setState(STATE_INITIALIZING)
        self._captureHandler = CaptureFiles.CaptureFileHandler()
        self._exit = False
        self._connectionAccessAddress = None
        self._packetListLock = threading.RLock()
        with self._packetListLock:
            self._packets = []

        self._packetReader = Packet.PacketReader(self._portnum,
                                                 callbacks=[
                                                     ("*",
                                                      self.passOnNotification)
                                                 ])
        self._devices = Devices.DeviceList(
            callbacks=[("*", self.passOnNotification)])

        self._missedPackets = 0
        self._packetsInLastConnection = None
        self._connectEventPacketCounterValue = None
        self._inConnection = False
        self._currentConnectRequest = None

        self._nProcessedPackets = 0

        self._switchingBaudRate = False

        self._attemptedBaudRates = []

        self._boardId = self._makeBoardId()
Beispiel #24
0
 def fetch_version_from_id(self, m_version_id):
     ver_ret = None
     filters = [
         ['project', 'is', {'type' : 'Project', 'id' : int(self.g_shotgun_project_id)}],
         ['id', 'is', m_version_id]
     ]
     fields = ['code', 'id', 'description', 'sg_first_frame', 'sg_last_frame', 'frame_count', 'sg_path_to_frames', 'sg_path_to_movie', 'entity', 'user', 'sg_task', 'sg_delivered', 'client_code', 'playlists', 'sg_path_to_matte_frames', 'sg_matte_ready_', 'sg_matte_delivered_']
     sg_ver = self.g_sg.find_one("Version", filters, fields)
     if not sg_ver:
         return ver_ret
     else:
         local_shot = self.fetch_shot_from_id(sg_ver['entity']['id'])
         local_task = self.fetch_task_from_id(int(sg_ver['sg_task']['id']), local_shot)
         local_artist = self.fetch_artist_from_id(int(sg_ver['user']['id']))
         ver_ret = Version.Version(sg_ver['code'], sg_ver['id'], sg_ver['description'], sg_ver['sg_first_frame'], sg_ver['sg_last_frame'], sg_ver['frame_count'], sg_ver['sg_path_to_frames'], sg_ver['sg_path_to_movie'], local_shot, local_artist, local_task)
         tmp_delivered = False
         if sg_ver['sg_delivered'] == 'True':
             tmp_delivered = True
         ver_ret.set_delivered(tmp_delivered)
         ver_ret.set_client_code(sg_ver['client_code'])
         tmp_playlists = []
         for tmp_pl_struct in sg_ver['playlists']:
             tmp_playlists.append(Playlist.Playlist(tmp_pl_struct['name'], [], tmp_pl_struct['id']))
         ver_ret.set_playlists(tmp_playlists)
         if sg_ver['sg_path_to_matte_frames']:
             ver_ret.set_path_to_matte_frames(sg_ver['sg_path_to_matte_frames'])
         if sg_ver['sg_matte_ready_'] == 'True':
             ver_ret.set_matte_ready(True)
         if sg_ver['sg_matte_delivered_'] == 'True':
             ver_ret.set_matte_delivered(True)
         return ver_ret
Beispiel #25
0
def test_return_methods(project, no):
    version = Version.create_version(project, no)
    spectra_list = version.return_spectra_add()
    spectra_dict = sbfl.get_method_spectra(spectra_list)
    for key in list(spectra_dict.keys())[:25]:
        print(key)
        print(spectra_dict[key])
    return spectra_dict
Beispiel #26
0
  def setUp(self):
    config = Config.load(Version.appName() + ".ini", setAsDefault = True)
    self.e = GameEngine(config)
    self.e.loadImgDrawing(self, "svg", "mfhlogo.png")

    while not self.svg:
      self.e.run()

    glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
Beispiel #27
0
def test_calculator(project, no):
    version = Version.create_version(project, no)
    fault_list = fault.analyze_fault_location(version, fault.ControlCollector())
    spectra_list = version.return_spectra_add()
    calculator_used = calculator.create_change_calculator('cohen', 0.2)
    spectra_list += sbfl.insert_spectra(spectra_list)
    for spectra in spectra_list:
        spectra.calculate_suspicious_value(calculator_used)
    spectra_list.sort(reverse=True)
    def __init__(self, serviceName, clientAuth):
        self.probeName = sys.argv[0].split("/")[-1]
        self.serviceName = serviceName

        self.optionParser = OptionParser(version="%s v.%s" % (self.probeName, Version.getVersion()))
        self.__enable_https_client_authentication = clientAuth

        signal.signal(signal.SIGALRM, self.sig_handler)
        signal.signal(signal.SIGTERM, self.sig_handler)
    def __init__( self, serviceName, clientAuth ):
        self.probeName = sys.argv[0].split("/")[-1]
        self.serviceName = serviceName

        self.optionParser = OptionParser(version="%s v.%s" % (self.probeName, Version.getVersion()))
        self.__enable_https_client_authentication = clientAuth
        
        signal.signal(signal.SIGALRM, self.sig_handler)
        signal.signal(signal.SIGTERM, self.sig_handler)
Beispiel #30
0
    def setUp(self):
        config = Config.load(Version.appName() + ".ini", setAsDefault=True)
        self.e = GameEngine(config)
        self.e.loadImgDrawing(self, "svg", "mfhlogo.png")

        while not self.svg:
            self.e.run()

        glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT
                | GL_DEPTH_BUFFER_BIT)
Beispiel #31
0
    def testLoading(self):
        config = Config.load(Version.appName() + ".ini", setAsDefault=True)
        e = GameEngine(config)
        infoFile = e.resource.fileName("tutorials", "bangbang", "song.ini")
        guitarFile = e.resource.fileName("tutorials", "bangbang", "guitar.ogg")
        songFile = e.resource.fileName("tutorials", "bangbang", "song.ogg")
        noteFile = e.resource.fileName("tutorials", "bangbang", "notes.mid")
        song = Song(e, infoFile, guitarFile, songFile, None, noteFile)

        assert int(song.bpm) == 120
Beispiel #32
0
  def testLoading(self):
    config = Config.load(Version.appName() + ".ini", setAsDefault = True)
    e = GameEngine(config)
    infoFile   = e.resource.fileName("tutorials", "bangbang", "song.ini")
    guitarFile = e.resource.fileName("tutorials", "bangbang", "guitar.ogg")
    songFile   = e.resource.fileName("tutorials", "bangbang", "song.ogg")
    noteFile   = e.resource.fileName("tutorials", "bangbang", "notes.mid")
    song = Song(e, infoFile, guitarFile, songFile, None, noteFile)

    assert int(song.bpm) == 120
Beispiel #33
0
def _usage(errmsg=None):
    usage = """Usage: %(prog)s [options]

Options:
  --help,    -h                       Show this help.
  --config=, -c [configfile]          Use this configuration file instead of
                                      fofix.ini from its standard location on
                                      your platform.  Use "reset" to use the
                                      usual fofix.ini but clear it first.
  --fullscreen=, -f [true/false]      Force (non-)usage of full-screen mode.
  --resolution=, -r [resolution]      Force a specific resolution to be used.
  --theme=,  -t [theme]               Force the specified theme to be used.
                                      Remember to quote the theme name if it
                                      contains spaces (e.g.
                                        %(prog)s -t "Guitar Hero III")
  --song=,   -s [songdir]             Play a song in one-shot mode.
                                      (See "One-shot mode options" below.)

Advanced options:
  --verbose, -v                       Verbose messages
  --debug,   -d                       Write debug file
  --opengl-error-checking             Enable OpenGL error checking

One-shot mode options (ignored unless in one-shot mode):
  --part=,   -p [part number]         0: Guitar, 1: Rhythm, 2: Bass, 3: Lead
                                      4: Drum,   5: Vocals
  --diff=,   -l [level of difficulty] 0: Expert, 1: Hard, 2: Medium, 3: Easy
                                      (Only applies if "part" is set)
  --mode=,   -m [game mode]           0: Quickplay, 1: Practice, 2: Career
""" % {
        "prog": sys.argv[0]
    }
    if errmsg is not None:
        usage = '%s: %s\n\n%s' % (sys.argv[0], errmsg, usage)
    if hasattr(sys, 'frozen') and os.name == 'nt':
        import win32api
        import win32con
        win32api.MessageBox(
            0, usage, '%s %s' % (Version.appNameSexy(), Version.version()),
            win32con.MB_OK)
    else:
        print usage
    sys.exit(1)
Beispiel #34
0
 def run(self):
     xgettext_cmd = find_command('xgettext')
     potfile = os.path.join('..', 'data', 'po', 'messages.pot')
     self.spawn([xgettext_cmd,
       '--package-name='+Version.PROGRAM_NAME,
       '--package-version='+Version.version(),
       '--copyright-holder=FoFiX Team',
       '-o', potfile] +
      ['-k' + funcname for funcname in self.FUNCNAMES] +
       glob.glob('*.py'))
Beispiel #35
0
def test_spectra_align(project, no):
    version = Version.create_version(project, no)
    original_spectra = version.return_spectra()
    spectra_matrix = sbfl.SpectraMatrix(original_spectra)
    ast_info_list = version.return_ast_info()
    node = ast_info_list[0]
    print('GZoltarSpectra')
    print(list(spectra_matrix.spectra_matrix.keys())[0])
    print('node')
    print(node.info_file)
Beispiel #36
0
 def _getHTMLClone(self, help_topic=None):
     """Gets a clone of the HTML, with the footer timestamped, and
     version information added, ready to be modified and sent to the
     browser."""
     clone = self.html.clone()
     timestamp = time.strftime('%H:%M on %A %B %d %Y', time.localtime())
     clone.footer.timestamp = timestamp
     clone.footer.version = Version.get_version_string(self.app_for_version)
     if help_topic:
         clone.helplink.href = "help?topic=%s" % (help_topic,)
     return clone
Beispiel #37
0
def setupWindows():
    setup(version=Version.version(),
          description="Rockin' it Oldskool!",
          name="Frets on Fire",
          url="http://www.unrealvoodoo.org",
          windows=[{
              "script": "FretsOnFire.py",
              "icon_resources": [(1, "fof.ico")]
          }],
          zipfile="data/library.zip",
          data_files=dataFiles,
          options=options)
Beispiel #38
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, 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[i] = True
              # 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)
              self.engine.resource.load(self, "uploadResult", fn, onLoad = self.handleWorldChartRanking)  #MFH

      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
Beispiel #39
0
    def record(self, commond_id, msg):
        ''' ¼Ç¼Æ÷ '''
        try:
            msg = Version.deformator(msg)
            commond_id = Version.R_CMD.get(commond_id, commond_id)

            self.content.append([commond_id, msg])
            if commond_id == 'PRIZE_MSG':
                msg = json.write([self.table_id, self.hand_id, self.content])
                send(msg)
        except:
            logging.error(traceback.format_exc())
Beispiel #40
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, 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
Beispiel #41
0
 def testVideoPlayerLayer(self):
   config = Config.load(Version.appName() + ".ini", setAsDefault = True)
   self.e = GameEngine(config)
   winWidth, winHeight = (self.e.view.geometry[2], self.e.view.geometry[3])
   vidPlayer = VideoPlayer(framerate, self.src, (winWidth, winHeight),
                           loop = False)
   self.e.view.pushLayer(vidPlayer)
   while not vidPlayer.finished:
     self.e.run()
   self.e.view.popLayer(vidPlayer)
   self.e.audio.close()
   self.e.quit()
Beispiel #42
0
def before_request():
    g.version = Version.get_string()
    g.web_config = web_config
    g.logout_url = logout_url

    g.settings = DB.Settings.load_dict(['cp_label', 'privacy_notice'])

    g.logo = None
    if config.has_section('logo'):
        g.logo = {}
        for key, value in config.items('logo'):
            g.logo[key] = value.decode('utf-8')
Beispiel #43
0
def _usage(errmsg=None):
  usage = """Usage: %(prog)s [options]

Options:
  --help,    -h                       Show this help.
  --config=, -c [configfile]          Use this configuration file instead of
                                      fofix.ini from its standard location on
                                      your platform.  Use "reset" to use the
                                      usual fofix.ini but clear it first.
  --fullscreen=, -f [true/false]      Force (non-)usage of full-screen mode.
  --geometry=,   -g [resolution][+x][+y] like Xorg standard argument
  --resolution=, -r [resolution]      Force a specific resolution to be used.
  --theme=,  -t [theme]               Force the specified theme to be used.
                                      Remember to quote the theme name if it
                                      contains spaces (e.g.
                                        %(prog)s -t "Guitar Hero III")
  --song=,   -s [songdir]             Play a song in one-shot mode.
                                      (See "One-shot mode options" below.)

Advanced options:
  --verbose, -v                       Verbose messages
  --debug,   -d                       Write debug file
  --opengl-error-checking             Enable OpenGL error checking

One-shot mode options (ignored unless in one-shot mode):
  --part=,   -p [part number]         0: Guitar, 1: Rhythm, 2: Bass, 3: Lead
                                      4: Drum,   5: Vocals
  --diff=,   -l [level of difficulty] 0: Expert, 1: Hard, 2: Medium, 3: Easy
                                      (Only applies if "part" is set)
  --mode=,   -m [game mode]           0: Quickplay, 1: Practice, 2: Career
""" % {"prog": sys.argv[0]}
  if errmsg is not None:
    usage = '%s: %s\n\n%s' % (sys.argv[0], errmsg, usage)
  if hasattr(sys, 'frozen') and os.name == 'nt':
    import win32api
    import win32con
    win32api.MessageBox(0, usage, '%s %s' % (Version.appNameSexy(), Version.version()), win32con.MB_OK)
  else:
    print usage
  sys.exit(1)
    def loadImages(self):

        self.loadIcons()

        #mesh...
        if os.path.exists(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","item.dae")):
            self.engine.resource.load(self, "itemMesh", lambda: Mesh(self.engine.resource.fileName("themes",self.themename,"setlist","item.dae")), synch = True)
        else:
            self.itemMesh = None
        if os.path.exists(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","library.dae")):
            self.engine.resource.load(self, "libraryMesh", lambda: Mesh(self.engine.resource.fileName("themes",self.themename,"setlist","library.dae")), synch = True)
        else:
            self.libraryMesh = None
        if os.path.exists(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","label.dae")):
            self.engine.resource.load(self, "label", lambda: Mesh(self.engine.resource.fileName("themes",self.themename,"setlist","label.dae")), synch = True)
        else:
            self.label = None
        if os.path.exists(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","library_label.dae")):
            self.engine.resource.load(self, "libraryLabel", lambda: Mesh(self.engine.resource.fileName("themes",self.themename,"setlist","library_label.dae")), synch = True)
        else:
            self.libraryLabel = None
        if os.path.exists(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","tier.dae")):
            self.engine.resource.load(self, "tierMesh", lambda: Mesh(self.engine.resource.fileName("themes",self.themename,"setlist","tier.dae")), synch = True)
        else:
            self.tierMesh = self.libraryMesh
        if os.path.exists(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","list.dae")):
            self.engine.resource.load(self, "listMesh", lambda: Mesh(self.engine.resource.fileName("themes",self.themename,"setlist","list.dae")), synch = True)
        else:
            self.listMesh = self.libraryMesh
Beispiel #45
0
    def truncate(cls, table):
        key_set = cls.genKSKey(table)
        s = set(DB.get_set(key_set))

        for k in s:
            cls(k, table).remove()

        DB.Redis().delete(key_set)

        cur_data_version = Version.loadCurDataVersion()
        for v in xrange(1, cur_data_version + 1):
            key_set = cls.genKSKey(table, v)
            DB.Redis().delete(key_set)
Beispiel #46
0
def sync_sys_table():
    t=Table('sys_table', metadata, autoload=True)
    data = {}
    cur_data_version = 1

    for i in t.select().execute():
        item = dict(i)
        data[item['name']] = int(item['version'])

        if (int(item['version']) > cur_data_version):
            cur_data_version = int(item['version'])

    print 'Syncing sys table', data

    DB.Redis().delete(CfgTable.SYS_TABLE)

    for k, v in data.items():
        DB.get_hash(CfgTable.SYS_TABLE)[k] = v

    print 'current_data_version:', cur_data_version

    Version.saveCurDataVersion(cur_data_version)
Beispiel #47
0
def analyze_experiment(analyzer_list, dict_experiment):
    if dict_experiment.get('need_spectra_number', None) is not None:
        # dict_experiment['spectra_number'] = Version.return_spectra_num_dict()
        dict_experiment['spectra_number'] = Version.dict_spectra_number[dict_experiment['need_spectra_number']]
    for experiment_no in dict_experiment.get('experiment_list', []):
        experiment = Version.Experiment(experiment_no)
        for formula in dict_experiment.get('formula_list', []):
            dict_experiment['formula'] = formula
            dict_experiment['analyze_list'] = experiment.return_analyze(formula)
            dict_experiment['fault_list'] = experiment.return_fault(formula)
            for analyzer in analyzer_list:
                if dict_experiment.get('split', False):
                    analyzer.split_analyze(experiment, dict_experiment)
                else:
                    analyzer.analyze(experiment, dict_experiment)
Beispiel #48
0
def time_experiment(project, no, relevant=False):
    # the AST has been extract, so does not extract again.
    # If change the way of extracting AST, rerun the following two lines.
    version = Version.create_version(project, no)
    modify_spectra(project, no, relevant)
    version.extract_AST()
    # version.extract_method_call()
    version.extract_variable()
    version.transfer_variable()
    #version.extract_predicate()
    #version.transfer_predicate()
    version.extract_key()
    version.transfer_key()
    version.transfer_block_info()
    version.transfer_block_variable()
Beispiel #49
0
 def uploadHighscores(self, url, songHash, part = parts[GUITAR_PART]):
   try:
     d = {
       "songName": self.songName,
       "songHash": songHash,
       "scores":   self.getObfuscatedScores(part = part),
       "scores_ext": self.getObfuscatedScoresExt(part = part),
       "version":  Version.version(),
       "songPart": part
     }
     data = urllib.urlopen(url + "?" + urllib.urlencode(d)).read()
     Log.debug("Score upload result: %s" % data)
     return data == "True"
   except Exception, e:
     Log.error(e)
     return False
Beispiel #50
0
  def __init__(self, dataPath = os.path.join("..", "data")):
    self.resultQueue = Queue()
    self.dataPaths = [dataPath]
    self.loaderSemaphore = BoundedSemaphore(value = 1)
    self.loaders = []

    #myfingershurt: the following should be global, and only done at startup.  Not every damn time a file is loaded.
    self.songPath = []
    self.baseLibrary = Config.get("game", "base_library")
    #evilynux - Support for songs in ~/.fretsonfire/songs (GNU/Linux and MacOS X)
    if self.baseLibrary == "None" and os.name == "posix":
      path = os.path.expanduser("~/." + Version.appName())
      if os.path.isdir(path):
        self.baseLibrary = path
        Config.set("game", "base_library", path)

    if self.baseLibrary and os.path.isdir(self.baseLibrary):
      self.songPath = [self.baseLibrary]
Beispiel #51
0
 def uploadHighscores(self, url, songHash):
   try:
     d = {
       "songName": self.songName,
       "songHash": songHash,
       "scores":   self.getObfuscatedScores(),
       "version":  Version.version()
     }
     data = urllib.urlopen(url + "?" + urllib.urlencode(d)).read()
     Log.debug("Score upload result: %s" % data)
     if ";" in data:
       fields = data.split(";")
     else:
       fields = [data, "0"]
     return (fields[0] == "True", int(fields[1]))
   except Exception, e:
     Log.error(e)
     return (False, 0)
Beispiel #52
0
def getWritableResourcePath():
    """
  Returns a path that holds the configuration for the application.
  """
    path = "."
    appname = Version.appName()
    if os.name == "posix":
        path = os.path.expanduser("~/." + appname)
    elif os.name == "nt":
        try:
            path = os.path.join(os.environ["APPDATA"], appname)
        except:
            pass
    try:
        os.mkdir(path)
    except:
        pass
    return path
Beispiel #53
0
  def testSaving(self):
    config = Config.load(Version.appName() + ".ini", setAsDefault = True)
    e = GameEngine(config)
    
    # Make a temp copy
    tmp   = "songtest_tmp"
    files = ["song.ini", "guitar.ogg", "song.ogg", "notes.mid"]
    try:
      os.mkdir(tmp)
      for f in files:
        shutil.copy(e.resource.fileName("tutorials", "bangbang", f), tmp)
    
      infoFile   = os.path.join(tmp, "song.ini")
      guitarFile = os.path.join(tmp, "guitar.ogg")
      songFile   = os.path.join(tmp, "song.ogg")
      noteFile   = os.path.join(tmp, "notes.mid")
      song       = Song(e, infoFile, guitarFile, songFile, None, noteFile)
      
      events1 = song.track[0].getAllEvents()
      
      song.save()
      song       = Song(e, infoFile, guitarFile, songFile, None, noteFile)
      
      events2 = song.track[0].getAllEvents()

      notes1 = [(time, event) for time, event in events1 if isinstance(event, Note)]      
      notes2 = [(time, event) for time, event in events2 if isinstance(event, Note)]
      
      for i, event in enumerate(zip(notes1, notes2)):
        t1, n1 = event[0]
        t2, n2 = event[1]
        
        if "-v" in sys.argv:
          print "%8d. %.3f + %.3f\t%2d\t     %.3f + %.3f\t%2d" % (i, t1, n1.length, n1.number, t2, n2.length, n2.number)
        
        # Allow 2ms of rounding error
        assert abs(t1 - t2) < 2
        assert abs(n1.length - n2.length) < 2
        assert n1.number == n2.number
    finally:
      # Load another song to free the copy
      pygame.mixer.music.load(e.resource.fileName("tutorials", "bangbang", "guitar.ogg"))
      shutil.rmtree(tmp)
Beispiel #54
0
 def main(self):
     """Main state loop."""
     done = self.doRun()
     self.clearScreen()
     self.view.render()
     if self.debugLayer:
         self.debugLayer.render(1.0, True)
     self.video.flip()
     # evilynux - Estimate the rendered frames per second.
     self.frames = self.frames+1
     # Estimate every 120 frames when highpriority is True.
     # Estimate every 2*config.fps when highpriority is False,
     # if you are on target, that should be every 2 seconds.
     if( not self.priority and self.frames == (self.fps << 1) ) or ( self.priority and self.frames == 120 ):
         self.fpsEstimate = self.clock.get_fps()
         # evilynux - Printing on the console with a frozen binary may cause a crash.
         if self.show_fps and not Version.isWindowsExe():
             print("%.2f fps" % self.fpsEstimate)
         self.frames = 0
     return done
Beispiel #55
0
    def checkIfEnabled(self):
        if Config.get("video", "shader_use"):
            if self.enabled:
                self.turnon = True
            else:
                self.set(os.path.join(Version.dataPath(), "shaders"))
        else:
            self.turnon = False

        if self.turnon:
            for i in self.shaders.keys():
                value = Config.get("video", "shader_" + i)
                if value != "None":
                    if value == "theme":
                        if Config.get("theme", "shader_" + i) == "True":
                            value = i
                        else:
                            continue
                    self.assigned[i] = value
            return True
        return False
Beispiel #56
0
def getWritableResourcePath():
  """
  Returns a path that holds the configuration for the application.
  """
  path = "."
  appname = Version.appName()
  if os.name == "posix":
    path = os.path.expanduser("~/." + appname)
    # evilynux - MacOS X, putting config files in the standard folder
    if( os.uname()[0] == "Darwin" ):
      path = os.path.expanduser("~/Library/Preferences/" + appname)
  elif os.name == "nt":
    try:
      path = os.path.join(os.environ["APPDATA"], appname)
    except:
      pass
  try:
    os.mkdir(path)
  except:
    pass
  return path
  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):
      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!"))
          else:
            name = Dialogs.getText(self.engine, _("%d points is a new high score! Player " + str(i+1) + " enter your name") % player.score, player.name)
            if name:
              player.name = name
            notesTotal = len([1 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"):
              self.uploadingScores = True
              fn = lambda: self.song.info.uploadHighscores(self.engine.config.get("game", "uploadurl"), 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] != None and self.highscoreIndex[1] != None 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