Пример #1
0
 def on_pushButtonImport_pressed(self):
     selected_path, selected_filter = getOpenFileName(
         self,
         caption="Import shortcuts",
         basedir=config.USER_HOME_PATH
     )
     if selected_path:
         shortcuts = json.read_file(selected_path)
         print(shortcuts)
Пример #2
0
    def __init__(self, name, path, default=True):
        self.PMX_PROFILE_NAME = name
        self.PMX_PROFILE_PATH = path
        self.PMX_PROFILE_DEFAULT = default
        self.PMX_SETTINGS_PATH = os.path.join(self.PMX_PROFILE_PATH, PMX_SETTINGS_NAME)
        self.PMX_STATE_PATH = os.path.join(self.PMX_PROFILE_PATH, PMX_STATE_NAME)
        self.PMX_TMP_PATH = os.path.join(self.PMX_PROFILE_PATH, 'tmp')
        self.PMX_LOG_PATH = os.path.join(self.PMX_PROFILE_PATH, 'log')
        self.PMX_CACHE_PATH = os.path.join(self.PMX_PROFILE_PATH, 'cache')
        self.PMX_SCREENSHOT_PATH = os.path.join(self.PMX_PROFILE_PATH, 'screenshot')

        self.settings = json.read_file(self.PMX_SETTINGS_PATH) or {}
        self.state = json.read_file(self.PMX_STATE_PATH) or {}

        self.settingsGroups = {}
        

        self.tmsettings = TextMateSettings(
            os.path.join(TM_PREFERENCES_PATH, TM_SETTINGS_NAME))
Пример #3
0
 def loadProject(cls, project_path, manager):
     if not os.path.isfile(project_path):
         raise exceptions.FileNotExistsException(project_path)
     try:
         data = json.read_file(project_path)
         project = cls(project_path, manager)
         project.load(data)
         manager.addProject(project)
         return project
     except Exception as e:
         import traceback
         traceback.print_exc()
         print("Error in project %s (%s)" % (project_path, e))
Пример #4
0
 def reload(self):
     data = json.read_file(self.path())
     self.setNodeName(data["name"])
     self.update(data)
Пример #5
0
 def restoreApplicationState(self):
     state = json.read_file(self.profile().PMX_STATE_PATH)
     self.application().setComponentState(state or {})