Esempio n. 1
0
    def OnInit (self):
        getOS().migrateConfig()
        self._fullConfigPath = getConfigPath ()
        Application.init(self._fullConfigPath)

        try:
            starter = Starter()
            starter.processConsole()
        except StarterExit:
            return True

        redirector = LogRedirector (self.getLogFileName (self._fullConfigPath))
        redirector.init()

        from outwiker.gui.mainwindow import MainWindow

        self.mainWnd = MainWindow(None, -1, "")
        self.SetTopWindow (self.mainWnd)

        Application.mainWindow = self.mainWnd
        Application.actionController = ActionController (self.mainWnd, Application.config)

        registerActions(Application)
        self.mainWnd.createGui()

        Application.plugins.load (getPluginsDirList())

        self.bindActivateApp()
        self.Bind (wx.EVT_QUERY_END_SESSION, self._onEndSession)

        starter.processGUI()

        return True
Esempio n. 2
0
    def OnInit(self):
        self._fullConfigPath = getConfigPath ()
        Application.init(self._fullConfigPath)

        # Если программа запускается в виде exe-шника, то перенаправить вывод ошибок в лог
        exepath = unicode (sys.argv[0], getOS().filesEncoding)
        if exepath.endswith (u".exe"):
            # Закоментировать следующую строку, если не надо выводить strout/strerr в лог-файл
            self.RedirectStdio (self.getLogFileName (self._fullConfigPath))
            pass

        from outwiker.gui.mainwindow import MainWindow
        
        wx.InitAllImageHandlers()
        self.mainWnd = MainWindow(None, -1, "")
        self.SetTopWindow (self.mainWnd)

        Application.mainWindow = self.mainWnd
        Application.actionController = ActionController (self.mainWnd, Application.config)

        registerActions(Application)
        self.mainWnd.createGui()

        Application.plugins.load (getPluginsDirList())

        self.bindActivateApp()
        self.Bind (wx.EVT_QUERY_END_SESSION, self._onEndSession)

        starter = Starter()
        starter.process()
        
        return True
Esempio n. 3
0
    def OnInit(self):
        getOS().migrateConfig()
        self._fullConfigPath = getConfigPath()
        Application.init(self._fullConfigPath)

        try:
            starter = Starter()
            starter.processConsole()
        except StarterExit:
            return True

        redirector = LogRedirector(self.getLogFileName(self._fullConfigPath))
        redirector.init()

        from outwiker.gui.mainwindow import MainWindow

        self.mainWnd = MainWindow(None, -1, "")
        self.SetTopWindow(self.mainWnd)

        Application.mainWindow = self.mainWnd
        Application.actionController = ActionController(
            self.mainWnd, Application.config)

        registerActions(Application)
        self.mainWnd.createGui()

        Application.plugins.load(getPluginsDirList())

        self.bindActivateApp()
        self.Bind(wx.EVT_QUERY_END_SESSION, self._onEndSession)

        starter.processGUI()

        return True
Esempio n. 4
0
 def run(self, params):
     # 0 - папка рядом с запускаемым файлом, затем идут другие папки, если они есть
     pluginsDir = getPluginsDirList()[-1]
     try:
         getOS().startFile(pluginsDir)
     except OSError:
         text = _(u"Can't open folder '{}'".format(pluginsDir))
         MessageBox(text, _(u"Error"), wx.ICON_ERROR | wx.OK)
Esempio n. 5
0
 def run (self, params):
     # 0 - папка рядом с запускаемым файлом, затем идут другие папки, если они есть
     pluginsDir = getPluginsDirList ()[-1]
     try:
         getOS().startFile (pluginsDir)
     except OSError:
         text = _(u"Can't open folder '{}'".format (pluginsDir))
         MessageBox (text, _(u"Error"), wx.ICON_ERROR | wx.OK)
Esempio n. 6
0
 def run(self, params):
     # 0 - папка рядом с запускаемым файлом,
     # затем идут другие папки, если они есть
     pluginsDir = getPluginsDirList()[-1]
     try:
         getOS().startFile(pluginsDir)
     except OSError:
         text = _(u"Can't open folder '{}'".format(pluginsDir))
         showError(self._application.mainWindow, text)
Esempio n. 7
0
    def install_plugin(self, name):
        """
        Install plugin by name.

        :return: True if plugin was installed, otherwise False
        """
        getAppInfo = self.vl.getAppInfoFromUrl
        getDownlodUrl = self.vl.getDownlodUrl

        plugin_info = self._installerPlugins.get(name, None)
        if plugin_info:

            appInfo = getAppInfo(plugin_info["url"])
            if not appInfo or not appInfo.versionsList:
                MessageBox(
                    _(u"The plugin description can't be downloaded. Please install plugin manually"
                      ), u"UpdateNotifier")
                return False

            api_required_version = appInfo.requirements.api_version
            if pv.checkVersionAny(outwiker.__api_version__,
                                  api_required_version) != 0:
                MessageBox(
                    _(u"The plugin required newer version of OutWiker. Please update OutWiker"
                      ), u"UpdateNotifier")
                return False

            # get link to latest version
            url = getDownlodUrl(appInfo)
            if not url:
                MessageBox(
                    _(u"The download link was not found in plugin description. Please install plugin manually"
                      ), u"UpdateNotifier")
                return False

            # getPluginsDirList[0] - папка рядом с запускаемым файлом, затем идут другие папки,
            # если они есть
            pluginPath = self.__deletedPlugins.get(
                name, os.path.join(getPluginsDirList()[-1], name.lower()))

            logger.info('install_plugin: {url} {path}'.format(url=url,
                                                              path=pluginPath))

            rez = UpdatePlugin().update(url, pluginPath)

            if rez:
                self._application.plugins.load([os.path.dirname(pluginPath)])
                self._updateDialog()
            else:
                MessageBox(
                    _(u"Plugin was NOT Installed. Please update plugin manually"
                      ), u"UpdateNotifier")
            return rez
Esempio n. 8
0
    def install_plugin(self, name):
        """
        Install plugin by name.

        :return: True if plugin was installed, otherwise False
        """
        getAppInfo = self.vl.getAppInfoFromUrl
        getDownlodUrl = self.vl.getDownlodUrl

        plugin_info = self._installerPlugins.get(name, None)
        if plugin_info:

            appInfo = getAppInfo(plugin_info["url"])
            if not appInfo or not appInfo.versionsList:
                MessageBox(_(u"The plugin description can't be downloaded. Please install plugin manually"),
                           u"UpdateNotifier")
                return False

            api_required_version = appInfo.requirements.api_version
            if pv.checkVersionAny(outwiker.core.__version__,
                                  api_required_version) != 0:
                MessageBox(_(u"The plugin required newer version of OutWiker. Please update OutWiker"),
                           u"UpdateNotifier")
                return False

            # get link to latest version
            url = getDownlodUrl(appInfo)
            if not url:
                MessageBox(_(u"The download link was not found in plugin description. Please install plugin manually"),
                           u"UpdateNotifier")
                return False

            # getPluginsDirList[0] - папка рядом с запускаемым файлом, затем идут другие папки,
            # если они есть
            pluginPath = self.__deletedPlugins.get(
                name,
                os.path.join(getPluginsDirList()[-1], name.lower()))

            logger.info(
                'install_plugin: {url} {path}'.format(
                    url=url, path=pluginPath))

            rez = UpdatePlugin().update(url, pluginPath)

            if rez:
                self._application.plugins.load([os.path.dirname(pluginPath)])
                self._updateDialog()
            else:
                MessageBox(
                    _(u"Plugin was NOT Installed. Please update plugin manually"),
                    u"UpdateNotifier")
            return rez
Esempio n. 9
0
    def OnInit(self):
        getOS().init()
        getOS().migrateConfig()

        self._fullConfigPath = getConfigPath()
        Application.init(self._fullConfigPath)
        self._locale = wx.Locale(wx.LANGUAGE_DEFAULT)

        try:
            starter = Starter()
            starter.processConsole()
        except StarterExit:
            return True

        if APP_DATA_DEBUG not in Application.sharedData:
            config = GeneralGuiConfig(Application.config)
            Application.sharedData[APP_DATA_DEBUG] = config.debug.value

        level = (logging.DEBUG
                 if Application.sharedData.get(APP_DATA_DEBUG, False)
                 else logging.WARNING)

        redirector = LogRedirector(self.getLogFileName(self._fullConfigPath),
                                   level)
        redirector.init()
        wx.Log.SetLogLevel(0)

        logger = logging.getLogger('outwiker')
        for n, dirname in enumerate(getSpecialDirList(u'')):
            logger.info(u'Special directory [{}]: {}'.format(n, dirname))

        from outwiker.gui.mainwindow import MainWindow

        self.mainWnd = MainWindow(None, -1, "")
        self.SetTopWindow(self.mainWnd)

        Application.mainWindow = self.mainWnd
        Application.actionController = ActionController(self.mainWnd,
                                                        Application.config)

        registerActions(Application)
        self.mainWnd.createGui()

        Application.plugins.load(getPluginsDirList())

        self.bindActivateApp()
        self.Bind(wx.EVT_QUERY_END_SESSION, self._onEndSession)

        starter.processGUI()

        return True
Esempio n. 10
0
    def OnInit(self):
        getOS().init()
        getOS().migrateConfig()

        self._fullConfigPath = getConfigPath()
        Application.init(self._fullConfigPath)
        self._locale = wx.Locale(wx.LANGUAGE_DEFAULT)

        try:
            starter = Starter()
            starter.processConsole()
        except StarterExit:
            return True

        if APP_DATA_DEBUG not in Application.sharedData:
            config = GeneralGuiConfig(Application.config)
            Application.sharedData[APP_DATA_DEBUG] = config.debug.value

        level = (logging.INFO
                 if Application.sharedData.get(APP_DATA_DEBUG, False)
                 else logging.WARNING)

        redirector = LogRedirector(self.getLogFileName(self._fullConfigPath),
                                   level)
        redirector.init()
        wx.Log.SetLogLevel(0)

        from outwiker.gui.mainwindow import MainWindow

        self.mainWnd = MainWindow(None, -1, "")
        self.SetTopWindow(self.mainWnd)

        Application.mainWindow = self.mainWnd
        Application.actionController = ActionController(self.mainWnd,
                                                        Application.config)

        registerActions(Application)
        self.mainWnd.createGui()

        Application.plugins.load(getPluginsDirList())

        self.bindActivateApp()
        self.Bind(wx.EVT_QUERY_END_SESSION, self._onEndSession)

        starter.processGUI()

        return True
Esempio n. 11
0
    def OnInit (self):
        getOS().migrateConfig()
        self._fullConfigPath = getConfigPath ()
        Application.init(self._fullConfigPath)

        try:
            starter = Starter()
            starter.processConsole()
        except StarterExit:
            return True

        # Если программа запускается в виде exe-шника, то перенаправить вывод ошибок в лог
        if getExeFile().endswith (u".exe"):
            # Закоментировать следующую строку, если не надо выводить strout/strerr в лог-файл
            self.RedirectStdio (self.getLogFileName (self._fullConfigPath))
            pass

        from outwiker.gui.mainwindow import MainWindow

        self.mainWnd = MainWindow(None, -1, "")
        self.SetTopWindow (self.mainWnd)

        Application.mainWindow = self.mainWnd
        Application.actionController = ActionController (self.mainWnd, Application.config)

        registerActions(Application)
        self.mainWnd.createGui()

        Application.plugins.load (getPluginsDirList())

        self.bindActivateApp()
        self.Bind (wx.EVT_QUERY_END_SESSION, self._onEndSession)

        starter.processGUI()

        return True
Esempio n. 12
0
 def loadPlugins(self):
     self._application.plugins.load(getPluginsDirList())