def config_dir(self): confd = QString2str( QApplication.applicationDirPath()) + os.sep + 'configs' dir = QDir(confd) if not dir.exists(): dir.mkpath(confd) return confd
def getResourceBinaryPath(): res = "" if platform.system() == 'Darwin': if inBundle(): res = QApplication.applicationDirPath() + "/../Resources/" else: res = os.path.dirname(os.path.realpath(__file__)) + "/../includes/mac/" elif platform.system() == "Linux": if isFrozen(): res = QApplication.applicationDirPath() + "/includes/linux/" else: res = os.path.dirname(os.path.realpath(__file__)) + "/../includes/linux/" else: if main_is_frozen(): res = os.path.dirname(sys.executable) + "\\" else: res = os.path.dirname(os.path.realpath(__file__)) + "\\..\\includes\\windows\\" return res
def getSystemTranslationsPath(): res = "" if platform.system() == 'Darwin': if inBundle(): res = QApplication.applicationDirPath() + "/../Resources/translations/" else: res = QLibraryInfo.location(QLibraryInfo.TranslationsPath) elif platform.system() == "Linux": if isFrozen(): res = QApplication.applicationDirPath() + "/translations/" else: res = QLibraryInfo.location(QLibraryInfo.TranslationsPath) else: if main_is_frozen(): res = os.path.dirname(sys.executable) + "\\translations\\" else: res = QLibraryInfo.location(QLibraryInfo.TranslationsPath) return res
def getTranslationsPath(): res = "" if platform.system() == 'Darwin': if inBundle(): res = QApplication.applicationDirPath() + "/../Resources/translations/" else: res = os.path.dirname(os.path.realpath(__file__)) + "/../translations/" elif platform.system() == "Linux": if isFrozen(): res = QApplication.applicationDirPath() + "/translations/" else: res = os.path.dirname(os.path.realpath(__file__)) + "/../translations/" else: if main_is_frozen(): res = os.path.dirname(sys.executable) + "\\translations\\" else: res = os.path.dirname(os.path.realpath(__file__)) + "\\..\\translations\\" return res
def getResourcePath(): res = "" if platform.system() == 'Darwin': if inBundle(): res = QApplication.applicationDirPath() + "/../Resources/" else: res = os.path.dirname(os.path.realpath(__file__)) + "/../includes/" elif platform.system() == "Linux": if isFrozen(): res = QApplication.applicationDirPath() + "/includes/" else: res = os.path.dirname(os.path.realpath(__file__)) + "/../includes/" else: if main_is_frozen(): res = os.path.dirname(sys.executable) + "\\" else: res = os.path.dirname( os.path.realpath(__file__)) + "\\..\\includes\\" return res
def getSystemTranslationsPath(): res = "" if platform.system() == 'Darwin': if inBundle(): res = QApplication.applicationDirPath( ) + "/../Resources/translations/" else: res = QLibraryInfo.location(QLibraryInfo.TranslationsPath) elif platform.system() == "Linux": if isFrozen(): res = QApplication.applicationDirPath() + "/translations/" else: res = QLibraryInfo.location(QLibraryInfo.TranslationsPath) else: if main_is_frozen(): res = os.path.dirname(sys.executable) + "\\translations\\" else: res = QLibraryInfo.location(QLibraryInfo.TranslationsPath) return res
if sys.platform == "darwin": sharePath = "/../Resources" else: # linux, win32 sharePath = "/../share/medux" settingsPath = "" arguments = sys.argv for arg in sys.argv: if arg.startswith("-settingspath"): settingsPath = arg.split("=")[1] if not settingsPath == "": QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, settingsPath) QSettings.setPath(QSettings.IniFormat, QSettings.SystemScope, os.path.normpath(QApplication.applicationDirPath() + sharePath)) QSettings.setDefaultFormat(QSettings.IniFormat) settings = QSettings(QSettings.IniFormat, QSettings.UserScope, Constants.ORGANISATION_NAME, Constants.APPLICATION_NAME) globalSettings = QSettings(QSettings.IniFormat, QSettings.SystemScope, Constants.ORGANISATION_NAME, Constants.APPLICATION_NAME) #TODO: add possibility for options, including dynamic plugin options componentManager = ComponentManager() pluginManager = PluginManager() pluginManager.setFileExtension("plugin") pluginManager.setGlobalSettings(globalSettings) pluginManager.setSettings(settings)