Exemplo 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
Exemplo n.º 2
0
    def setUp(self):
        self.initApplication()

        self.actionController = ActionController(
            self.mainWindow, self.application.config)
        self.application.config.remove_section(
            self.actionController.configSection)
        self.fileMenu = self.mainWindow.menuController[MENU_FILE]
Exemplo n.º 3
0
    def setUp(self):
        self.initApplication()
        self.wikiroot = self.createWiki()
        self.actionController = ActionController(self.mainWindow,
                                                 self.application.config)
        self.application.config.remove_section(
            self.actionController.configSection)

        self._actionVal = 0
Exemplo n.º 4
0
    def initMainWindow(self):
        self.mainWnd = MainWindow(self._application)
        self.SetTopWindow(self.mainWnd)

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

        registerActions(self._application)
        self.mainWnd.createGui()
Exemplo n.º 5
0
    def testHotKeySaveConfig3(self):
        action = ExampleAction()

        self.actionController.register(action)
        self.actionController.saveHotKeys()

        otherActionController = ActionController(self.mainWindow,
                                                 self.application.config)
        otherActionController.register(action)

        self.assertIsNone(otherActionController.getHotKey(action.stringId))
Exemplo n.º 6
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
Exemplo n.º 7
0
    def testHotKeySaveConfig3(self):
        action = ExampleAction()

        self.actionController.register(action)
        self.actionController.saveHotKeys()

        otherActionController = ActionController(self.mainWindow, self.application.config)
        otherActionController.register(action)

        self.assertEqual(otherActionController.getHotKey(action.stringId).key,
                         "")
        self.assertFalse(otherActionController.getHotKey(action.stringId).ctrl)
        self.assertFalse(otherActionController.getHotKey(action.stringId).shift)
        self.assertFalse(otherActionController.getHotKey(action.stringId).alt)
Exemplo n.º 8
0
    def testHotKeySaveConfig2(self):
        action = ExampleAction()
        hotkey = HotKey("F11", ctrl=True)

        self.actionController.register(action, hotkey)
        self.actionController.saveHotKeys()

        otherActionController = ActionController(self.mainWindow, self.application.config)
        otherActionController.register(action, HotKey("F1", shift=True))

        self.assertEqual(otherActionController.getHotKey(action.stringId).key,
                         "F11")
        self.assertTrue(otherActionController.getHotKey(action.stringId).ctrl)
        self.assertFalse(otherActionController.getHotKey(action.stringId).shift)
        self.assertFalse(otherActionController.getHotKey(action.stringId).alt)
Exemplo n.º 9
0
    def testHotKeySaveConfig1(self):
        action = TestAction()
        hotkey = HotKey("F11", ctrl=True)

        self.actionController.register(action, hotkey)
        self.actionController.saveHotKeys()

        otherActionController = ActionController(self.wnd, Application.config)
        otherActionController.register(action)

        self.assertEqual(
            otherActionController.getHotKey(action.stringId).key, "F11")
        self.assertTrue(otherActionController.getHotKey(action.stringId).ctrl)
        self.assertFalse(
            otherActionController.getHotKey(action.stringId).shift)
        self.assertFalse(otherActionController.getHotKey(action.stringId).alt)
Exemplo n.º 10
0
    def setUp(self):
        self.path = mkdtemp(prefix=u'OutWiker_Абырвалг абырвалг_' +
                            unicode(self.__class__.__name__, 'utf-8'))

        Application.config.remove_section(MainWindowConfig.MAIN_WINDOW_SECTION)

        generalConfig = GeneralGuiConfig(Application.config)
        generalConfig.askBeforeExit.value = False

        self.wnd = MainWindow(None, -1, "")
        Application.mainWindow = self.wnd
        Application.actionController = ActionController(
            self.wnd, Application.config)
        wx.GetApp().SetTopWindow(self.wnd)

        registerActions(Application)
        self.wnd.createGui()

        self.wikiroot = WikiDocument.create(self.path)

        Tester.dialogTester.clear()
        Application.wikiroot = None
Exemplo n.º 11
0
    def testDelayChangeHotkeyToolbar(self):
        toolbar = self.wnd.toolbars[self.wnd.PLUGINS_TOOLBAR_STR]
        image = "../test/images/save.png"

        hotkey = HotKey("F11", ctrl=True)

        action = TestAction()
        self.actionController.register(action, HotKey("F11"))

        self.actionController.appendToolbarButton(action.stringId, toolbar,
                                                  image)

        self.actionController.setHotKey(action.stringId, hotkey, False)

        self.assertEqual(self._getToolItemLabel(toolbar, action.stringId),
                         u"{} ({})".format(action.title, "F11"))

        otherActionController = ActionController(self.wnd, Application.config)
        otherActionController.register(action, None)

        self.assertEqual(otherActionController.getHotKey(action.stringId),
                         hotkey)
Exemplo n.º 12
0
    def testDelayChangeHotkeyToolbar(self):
        toolbar = self.mainWindow.toolbars[TOOLBAR_PLUGINS]
        image = "testdata/images/save.png"

        hotkey = HotKey("F11", ctrl=True)

        action = ExampleAction()
        self.actionController.register(action, HotKey("F11"))

        self.actionController.appendToolbarButton(action.stringId, toolbar,
                                                  image)

        self.actionController.setHotKey(action.stringId, hotkey, False)

        self.assertEqual(self._getToolItemLabel(toolbar, action.stringId),
                         "{} ({})".format(action.title, "F11"))

        otherActionController = ActionController(self.mainWindow,
                                                 self.application.config)
        otherActionController.register(action, None)

        self.assertEqual(otherActionController.getHotKey(action.stringId),
                         hotkey)
Exemplo n.º 13
0
 def setUp(self):
     BaseMainWndTest.setUp(self)
     self.actionController = ActionController(self.wnd, Application.config)
     Application.config.remove_section(self.actionController.configSection)