本文整理汇总了Python中outwiker.core.application.Application类的典型用法代码示例。如果您正苦于以下问题:Python Application类的具体用法?Python Application怎么用?Python Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _showHtml
def _showHtml (self):
"""
Подготовить и показать HTML текущей страницы
"""
assert self._currentpage != None
status_item = 0
setStatusText (_(u"Page rendered. Please wait…"), status_item)
Application.onHtmlRenderingBegin (self._currentpage, self.htmlWindow)
try:
self.currentHtmlFile = self.generateHtml (self._currentpage)
self.htmlWindow.LoadPage (self.currentHtmlFile)
except IOError as e:
# TODO: Проверить под Windows
MessageBox (_(u"Can't save file %s") % (unicode (e.filename)),
_(u"Error"),
wx.ICON_ERROR | wx.OK)
except OSError as e:
MessageBox (_(u"Can't save HTML-file\n\n%s") % (unicode (e)),
_(u"Error"),
wx.ICON_ERROR | wx.OK)
setStatusText (u"", status_item)
Application.onHtmlRenderingEnd (self._currentpage, self.htmlWindow)
示例2: _onSwitchCodeHtml
def _onSwitchCodeHtml (self):
assert self._currentpage != None
self.Save()
status_item = 0
setStatusText (_(u"Page rendered. Please wait…"), status_item)
Application.onHtmlRenderingBegin (self._currentpage, self.htmlWindow)
try:
self.currentHtmlFile = self.generateHtml (self._currentpage)
self._showHtmlCode(self.currentHtmlFile)
except IOError as e:
# TODO: Проверить под Windows
MessageBox (_(u"Can't save file %s") % (unicode (e.filename)),
_(u"Error"),
wx.ICON_ERROR | wx.OK)
except OSError as e:
MessageBox (_(u"Can't save HTML-file\n\n%s") % (unicode (e)),
_(u"Error"),
wx.ICON_ERROR | wx.OK)
setStatusText (u"", status_item)
Application.onHtmlRenderingEnd (self._currentpage, self.htmlWindow)
self._enableAllTools ()
self.htmlCodeWindow.SetFocus()
self.htmlCodeWindow.Update()
示例3: OnInit
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
示例4: __init__
def __init__(self, *args, **kwds):
kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.THICK_FRAME
wx.Dialog.__init__(self, *args, **kwds)
self.__treeBook = wx.Treebook(self, -1)
self.__set_properties()
self.__do_layout()
# Страницы с настройками
self.__generalPage = None
self.__editorPage = None
self.__spellPage = None
self.__htmlRenderPage = None
self.__textPrintPage = None
self.__pluginsPage = None
self.__hotkeysPage = None
self.__htmlEditorPage = None
self.__iconsetPage = None
self.__tagsPage = None
self.__attachPage = None
self.__createPages()
Application.onPreferencesDialogCreate(self)
self.__loadAllOptions()
self.Center(wx.CENTRE_ON_SCREEN)
示例5: OnInit
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
示例6: testTrayMinimize3
def testTrayMinimize3 (self):
self.wnd.taskBarIcon.config.minimizeToTray.value = True
self.wnd.taskBarIcon.config.alwaysShowTrayIcon.value = True
self.wnd.taskBarIcon.config.startIconized.value = False
Application.onPreferencesDialogClose(None)
#self._processEvents()
self.wnd.Show()
self.wnd.Iconize(False)
self._processEvents()
self.assertTrue (self.wnd.IsShown())
self.assertTrue (self.wnd.taskBarIcon.IsIconInstalled())
self.wnd.Iconize(True)
self._processEvents()
self.assertTrue (self.wnd.IsShown())
self.assertTrue (self.wnd.taskBarIcon.IsIconInstalled())
self.wnd.taskBarIcon.restoreWindow()
#self._processEvents()
self.assertTrue (self.wnd.IsShown())
self.assertTrue (self.wnd.taskBarIcon.IsIconInstalled())
示例7: CreatePopupMenu
def CreatePopupMenu (self):
trayMenu = wx.Menu()
trayMenu.Append (self.ID_RESTORE, _(u"Restore"))
trayMenu.Append (self.ID_EXIT, _(u"Exit"))
Application.onTrayPopupMenu (trayMenu, self)
return trayMenu
示例8: __onOk
def __onOk (self, event):
try:
self.__saveAll()
except PreferencesException:
pass
Application.onPreferencesDialogClose(self)
self.EndModal (wx.ID_OK)
示例9: __onLinkClicked
def __onLinkClicked(self, href, gtk_mouse_button, gtk_key_modifier):
"""
Клик по ссылке
Возвращает False, если обрабатывать ссылку разрешить компоненту,
в противном случае - True (если обрабатываем сами)
href - ссылка
gtk_mouse_button - кнопка мыши, с помощью которой кликнули по ссылке
(1 - левая, 2 - средняя, 3 - правая, -1 - не известно)
gtk_key_modifier - зажатые клавиши (1 - Shift, 4 - Ctrl)
"""
source_href = href
href = urllib.parse.unquote(href)
href = self._decodeIDNA(href)
logger.debug('__onLinkClicked. href_src={source_href}; href_process={href}'.format(
source_href=source_href, href=href)
)
(url, page, filename, anchor) = self.__identifyUri(href)
logger.debug('__onLinkClicked. url={url}, page={page}, filename={filename}, anchor={anchor}'.format(
url=url, page=page, filename=filename, anchor=anchor))
modifier = self.__gtk2OutWikerKeyCode(gtk_key_modifier)
mouse_button = self.__gtk2OutWikerMouseButtonCode(gtk_mouse_button)
params = self._getClickParams(source_href,
mouse_button,
modifier,
url,
page,
filename,
anchor)
Application.onLinkClick(self._currentPage, params)
if params.process:
return True
if url is not None:
self.openUrl(url)
elif (page is not None and
(mouse_button == ID_MOUSE_MIDDLE or modifier == ID_KEY_CTRL)):
Application.mainWindow.tabsController.openInTab(page, True)
elif page is not None:
if anchor is not None:
Application.sharedData[APP_DATA_KEY_ANCHOR] = anchor
self._currentPage.root.selectedPage = page
elif filename is not None:
try:
outwiker.core.system.getOS().startFile(filename)
except OSError:
text = _(u"Can't execute file '%s'") % filename
outwiker.core.commands.showError(Application.mainWindow, text)
elif anchor is not None:
return False
return True
示例10: setStatusText
def setStatusText (self, link, text):
"""
Execute onHoverLink event and set status text
"""
link_decoded = self._decodeIDNA (link)
params = HoverLinkParams (link = link_decoded, text = text)
Application.onHoverLink (page=self._currentPage, params = params)
outwiker.core.commands.setStatusText (params.text, self._status_item)
示例11: make
def make (self, page, config):
"""
Создать парсер
page - страница, для которой создается парсер,
config - экземпляр класса, хранящий настройки
"""
parser = Parser (page, config)
self._addCommands (parser)
Application.onWikiParserPrepare (parser)
return parser
示例12: _onStyleNeeded
def _onStyleNeeded(self, event):
if (not self._styleSet and
datetime.now() - self._lastEdit >= self._DELAY):
page = Application.selectedPage
text = self._getTextForParse()
params = EditorStyleNeededParams(self,
text,
self._enableSpellChecking)
Application.onEditorStyleNeeded(page, params)
self._styleSet = True
示例13: destroyPageView
def destroyPageView (self):
"""
Уничтожить текущий контрол
"""
if self.__pageView != None:
Application.onPageViewDestroy (self.__currentPage)
self.contentSizer.Detach (self.__pageView)
self.__pageView.Close()
self.__pageView = None
self.__currentPage = None
示例14: reset
def reset():
"""
Установить словарь фабрик в первоначальное состояние. Используется для тестирования.
Это не конструктор. В случае изменения списка фабрик, установленных по умолчанию, нужно изменять этот метод.
"""
FactorySelector._factories = {
factory.getTypeString(): factory
for factory in [WikiPageFactory(), HtmlPageFactory(), TextPageFactory(), SearchPageFactory()]
}
Application.onPageFactoryListChange(newfactory=None)
示例15: openWiki
def openWiki (path, readonly=False):
wikiroot = None
Application.onStartTreeUpdate(None)
def threadFunc (path, readonly):
try:
return WikiDocument.load (path, readonly)
except IOError, error:
return error
except outwiker.core.exceptions.RootFormatError, error:
return error