def loadScriptGestures(self):
     conf = self.conf
     defaultScriptGestures = {
         "goToTime": "kb:control+;",
         "reportElapsedTime": "kb:;",
         "reportRemainingTime": "kb:,",
         "reportTotalTime": "kb:.",
         "reportCurrentSpeed": "kb:/",
         "recordResumeFile": "kb:nvda+control+f5",
         "resumePlayback": "kb:nvda+control+f6",
         "continuePlayback": "kb:alt+control+r",
         "hideShowMenusView": "kb:control+h",
         "adjustmentsAndEffects": "kb:control+e",
     }
     self.scriptGestures = defaultScriptGestures.copy()
     if (conf is None) or ("script-gestures" not in conf.sections):
         printDebug(
             "loadScriptGestures: Default script gestures assignment loaded"
         )
         return
     section = conf["script-gestures"]
     for scriptName in defaultScriptGestures:
         if scriptName in section:
             self.scriptGestures[scriptName] = section[scriptName]
     printDebug("loadScriptGestures: script gestures assignment loaded")
 def __init__(self):
     curAddon = addonHandler.getCodeAddon()
     self.addonDir = curAddon.path
     localeSettingsFile = self.getLocaleSettingsIniFilePath()
     if localeSettingsFile is None:
         printDebug("LocaleSettings __init__ :Default config")
         self.conf = None
     else:
         self.conf = ConfigObj(localeSettingsFile,
                               encoding="utf-8",
                               list_values=False)
     self.loadScriptGestures()
Example #3
0
def ifPathsAreValid(paths) :
  ''' Verify if path exists and are readable. '''
  if paths.nml :
    if os.path.isfile(paths.nml) : pass
    else :
      debug.printDebug("ERROR", "Filepath {0} is not valid".format(paths.nml))
      return False
  if paths.sbml :
    if os.path.isfile(paths.sbml) : pass 
    else :
      debug.printDebug("ERROR", "Filepath {0} is not valid".format(paths.sbml))
      return False
  return True
Example #4
0
def ifPathsAreValid(paths):
    ''' Verify if path exists and are readable. '''
    if paths:
        for p in paths:
            if not paths[p]: continue
            for path in paths[p]:
                if not path: continue
                if os.path.isfile(path): pass
                else:
                    debug.printDebug(
                        "ERROR", "Filepath {0} does not exists".format(path))
                    return False
            # check if file is readable
            if not os.access(path, os.R_OK):
                debug.dump("ERROR", "File {0} is not readable".format(path))
                return False
    return True
 def _secondPass(self, lines, newVLCKeys):
     # add new key definition
     keyNames = list(newVLCKeys.keys())
     newLines = []
     for line in lines:
         newLines.append(line)
         if line[0] == "#":
             key = line[1:].split("=")[0]
             try:
                 key = key.strip()
             except Exception:
                 pass
             if key in keyNames:
                 line = "%s=%s\r\n" % (key, newVLCKeys[key])
                 newLines.append(line)
                 printDebug("VLC Shortcut modification: %s" % line)
     return newLines
Example #6
0
def ifPathsAreValid(paths) :
    ''' Verify if path exists and are readable. '''
    if paths :
        for p in paths :
            if not paths[p] : continue
            for path in paths[p] :
                if not path : continue
                if os.path.isfile(path) : pass
                else :
                    debug.printDebug("ERROR"
                        , "Filepath {0} does not exists".format(path))
                    return False
            # check if file is readable
            if not os.access(path, os.R_OK) :
              debug.dump("ERROR", "File {0} is not readable".format(path))
              return False
    return True
 def deleteConfigurationFolder(self):
     printDebug("deleteConfigurationFolder")
     if not self.canDeleteConfigurationFolder():
         return
     try:
         shutil.rmtree(self.vlcSettingsDir)
         # Translators: message to user: VLC configuration folder has been deleted"),
         msg = _("VLC configuration folder (%s) has been deleted. "
                 "Before modify VLC shortcuts, you must start VLC once."
                 ) % self.vlcSettingsDir
         # Translators: title of message box.
         dialogTitle = _("Information")
         messageBox(msg, makeAddonWindowTitle(dialogTitle),
                    wx.OK | wx.ICON_WARNING)
     except OSError:
         # Translators: message to user: VLC configuration folder cannot be deleted.
         msg = _("VLC configuration folder \"%s\" cannot be deleted"
                 ) % self.vlcSettingsDir
         # Translators: title of message box.
         dialogTitle = _("Error")
         messageBox(msg, makeAddonWindowTitle(dialogTitle),
                    wx.OK | wx.ICON_WARNING)
 def __init__(self, addon=None):
     printDebug("VLCSettings __init__")
     self.addon = addon if addon else addonHandler.getCodeAddon()
     self.addonDir = self.addon.path
     self.vlcSettingsDir = self.getVlcSettingsFolderPath()
     if self.vlcInitialized:
         printDebug("VLCSettings: VLC initialized")
     else:
         printDebug("VLCSettings: VLC not initialized")
Example #9
0
__credits__ = "NCBS"

__log__     = """


"""
# Basic imports
import os 
import sys 
import logging 
import debug 

logger = logging.getLogger('multiscale')
try:
    import cElementTree as etree
    debug.printDebug("DEBUG", "running with lxml.etree")
except ImportError:
    try:
        # Python 2.5
        import xml.etree.cElementTree as etree
        debug.printDebug("DEBUG", "running with cElementTree")
    except ImportError:
        try:
            # Python 2.5
            import xml.etree.cElementTree as etree
            debug.printDebug("DEBUG", "running with ElementTree")
        except ImportError:
            try:
              # normal cElementTree install
              import cElementTree as etree
              debug.printDebug("DEBUG", "running with cElementTree")