def __init__(self, iconsPanel, application, dialog): super(IconsController, self).__init__(application) self._dialog = dialog self._iconsPanel = iconsPanel self._groupsMaxWidth = 200 self._page = None self._default_group_cover = os.path.join(getImagesDir(), u'icons_cover_default.png') guiconfig = GeneralGuiConfig(application.config) self._recentIconsList = RecentIconsList( guiconfig.iconsHistoryLength.value, application.config, getIconsDirList()[0]) self._recentIconsList.load() self._iconsPanel.iconsList.Bind(EVT_ICON_SELECTED, handler=self._onIconSelected) self._iconsPanel.groupCtrl.Bind(EVT_SWITCH, handler=self._onGroupSelect) self._selectedIcon = None self._groupsInfo = self._getGroupsInfo() self._appendGroups() group_index = 0 if len(self._recentIconsList) else 1 self._iconsPanel.groupCtrl.SetSelection(group_index)
def __init__(self, parent: wx.Window, columns: List[BaseColumn]): super().__init__(parent) self._columns = columns self._defaultIcon = os.path.join(getImagesDir(), "page.png") self._imageList = ImageListCache(self._defaultIcon) self._propagationLevel = 15 self.SetBackgroundColour(wx.Colour(255, 255, 255)) self._sizer = wx.FlexGridSizer(cols=1) self._sizer.AddGrowableCol(0) self._sizer.AddGrowableRow(0) self._listCtrl = ULC.UltimateListCtrl( self, agwStyle=ULC.ULC_REPORT | ULC.ULC_SINGLE_SEL | ULC.ULC_VRULES | ULC.ULC_HRULES | ULC.ULC_SHOW_TOOLTIPS | ULC.ULC_NO_HIGHLIGHT) self._listCtrl.Bind(ULC.EVT_LIST_ITEM_HYPERLINK, handler=self._onPageClick) self._listCtrl.Bind(ULC.EVT_LIST_COL_CLICK, handler=self._onColClick) self._listCtrl.SetHyperTextNewColour(wx.BLUE) self._listCtrl.SetHyperTextVisitedColour(wx.BLUE) self._listCtrl.AssignImageList(self._imageList.getImageList(), wx.IMAGE_LIST_SMALL) self._sizer.Add(self._listCtrl, flag=wx.EXPAND) self.SetSizer(self._sizer)
def __init__(self, parent, *args, **kwds): super(BaseTextPanel, self).__init__(parent, *args, **kwds) self._application = Application self.searchMenu = None # Предыдущее сохраненное состояние. # Используется для выявления изменения страницы внешними средствами self._oldContent = None # Диалог, который показывается, если страница изменена сторонними программами. # Используется для проверки того, что диалог уже показан и еще раз его показывать не надо self.externalEditDialog = None self.searchMenuIndex = 2 self.imagesDir = getImagesDir() self._spellOnOffEvent, self.EVT_SPELL_ON_OFF = wx.lib.newevent.NewEvent( ) self._addSearchTools() self._addSpellTools() self._application.onAttachmentPaste += self.onAttachmentPaste self._application.onPreferencesDialogClose += self.onPreferencesDialogClose self._onSetPage += self.__onSetPage
def create (root, phrase = u"", tags = [], strategy = AllTagsSearchStrategy): """ Создать страницу с поиском. Если страница существует, то сделать ее активной """ title = GlobalSearch.pageTitle number = 1 page = None imagesDir = getImagesDir() while page is None: page = root[title] if page is None: page = SearchPageFactory().create (root, title, []) page.icon = os.path.join (imagesDir, "global_search.png") elif page.getTypeString() != SearchWikiPage.getTypeString(): number += 1 title = u"%s %d" % (GlobalSearch.pageTitle, number) page = None page.phrase = phrase page.searchTags = [tag for tag in tags] page.strategy = strategy page.root.selectedPage = page return page
def create (root, phrase = u"", tags = [], strategy = AllTagsSearchStrategy): """ Создать страницу с поиском. Если страница существует, то сделать ее активной """ title = GlobalSearch.pageTitle number = 1 page = None imagesDir = getImagesDir() while page == None: page = root[title] if page == None: page = SearchPageFactory.create (root, title, []) page.icon = os.path.join (imagesDir, "global_search.png") elif page.getTypeString() != SearchPageFactory.getTypeString(): number += 1 title = u"%s %d" % (GlobalSearch.pageTitle, number) page = None page.phrase = phrase page.searchTags = [tag for tag in tags] page.strategy = strategy # Скопируем картинку для тегов #if not page.readonly: # tagiconpath = os.path.join (getImagesDir(), "tag.png") # shutil.copy (tagiconpath, os.path.join (page.path, "__tag.png") ) page.root.selectedPage = page return page
def __init__(self, parent, multiselect=False): wx.ScrolledWindow.__init__(self, parent, style=wx.BORDER_THEME) self._backgroundColor = wx.Colour(255, 255, 255) self._canvas = wx.Panel(self) self._canvas.SetSize((0, 0)) self._canvas.SetBackgroundColour(self._backgroundColor) self._canvas.Bind(wx.EVT_PAINT, handler=self.__onPaint) self._canvas.Bind(wx.EVT_LEFT_DOWN, handler=self.__onCanvasClick) self._canvas.Bind(wx.EVT_MOTION, handler=self.__onMouseMove) self.Bind(wx.EVT_SCROLLWIN, handler=self.__onScroll) self.cellWidth = 32 self.cellHeight = 32 self.margin = 1 self.multiselect = multiselect # Path to current page icon self._currentIcon = None self._lastClickedButton = None self.SetScrollRate(0, 0) self.SetBackgroundColour(wx.Colour(255, 255, 255)) # Список картинок, которые хранятся в окне self.buttons = [] self._iconFileNames = [] self.defaultIcon = os.path.join(getImagesDir(), "page.png") self.Bind(wx.EVT_SIZE, self.__onSize)
def __init__(self, *args, **kwds): self.imagesDir = getImagesDir() kwds["style"] = wx.TAB_TRAVERSAL wx.Panel.__init__(self, *args, **kwds) self.phraseTextCtrl = wx.SearchCtrl (self, -1, "", style=wx.TE_PROCESS_ENTER) self.phraseTextCtrl.ShowCancelButton(True) self.phraseTextCtrl.SetDescriptiveText (_(u"Search")) self.nextSearchBtn = wx.BitmapButton(self, -1, wx.Bitmap(os.path.join (self.imagesDir, "arrow_down.png"), wx.BITMAP_TYPE_ANY)) self.prevSearchBtn = wx.BitmapButton(self, -1, wx.Bitmap(os.path.join (self.imagesDir, "arrow_up.png"), wx.BITMAP_TYPE_ANY)) self.resultLabel = wx.StaticText(self, -1, "") self.resultLabel.SetMinSize ((150, -1)) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.onCloseClick, self.phraseTextCtrl) self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.onNextSearch, self.phraseTextCtrl) self.Bind(wx.EVT_TEXT_ENTER, self.onNextSearch, self.phraseTextCtrl) self.Bind(wx.EVT_TEXT, self.onTextEnter, self.phraseTextCtrl) self.Bind(wx.EVT_BUTTON, self.onNextSearch, self.nextSearchBtn) self.Bind(wx.EVT_BUTTON, self.onPrevSearch, self.prevSearchBtn) self.nextSearchBtn.SetToolTipString (_(u"Find Next") ) self.prevSearchBtn.SetToolTipString (_(u"Find Previous") ) self.Bind (wx.EVT_CLOSE, self.onClose) self.phraseTextCtrl.Bind (wx.EVT_KEY_DOWN, self.onKeyDown)
def __init__(self, currversion, *args, **kwds): self.imagesDir = getImagesDir() wx.Dialog.__init__(self, *args, **kwds) self.titleLabel = wx.StaticText(self, -1, _("OutWiker")) self.versionTitleLabel = wx.StaticText(self, -1, _("Version:")) self.versionLabel = wx.StaticText(self, -1, "") self.notebook = wx.Notebook(self, -1, style=0) self.aboutPane = wx.Panel(self.notebook, -1) self.logo = wx.StaticBitmap(self.aboutPane, -1, wx.Bitmap(os.path.join (self.imagesDir, "outwiker_64x64.png"), wx.BITMAP_TYPE_ANY)) self.description = wx.StaticText (self.aboutPane, -1, _("OutWiker is personal wiki system and tree notes outliner.")) self.license = wx.StaticText(self.aboutPane, -1, _("License: GPL 3")) self.siteLabel = wx.StaticText(self.aboutPane, -1, _("OutWiker's page:")) self.outwikerUrl = HyperLinkCtrl(self.aboutPane, -1, label=_("http://jenyay.net/Outwiker/English"), URL=_("http://jenyay.net/Outwiker/English")) self.contactsPane = wx.Panel(self.notebook, -1) self.email = HyperLinkCtrl(self.contactsPane, -1, label=_(u"*****@*****.**"), URL=_(u"mailto:[email protected]")) self.googleplus = HyperLinkCtrl(self.contactsPane, -1, label=_(u"Google+ page"), URL=_(u"https://plus.google.com/u/0/b/113404982971748285098/113404982971748285098/posts")) self.facebook = HyperLinkCtrl(self.contactsPane, -1, label=_(u"Facebook page"), URL=_(u"http://www.facebook.com/outwiker")) self.livejournal = HyperLinkCtrl(self.contactsPane, -1, label=_(u"Livejournal community"), URL=_(u"http://ru-outwiker.livejournal.com/?style=mine")) self.twitter = HyperLinkCtrl(self.contactsPane, -1, label=_(u"Twitter"), URL=_(u"https://twitter.com/OutWiker")) self.vkontakte = HyperLinkCtrl(self.contactsPane, -1, label=_(u"Vkontakte group"), URL=_(u"http://vk.com/outwiker")) self.okButton = wx.Button(self, wx.ID_OK, "") self.__set_properties() self.__do_layout() self.currversion = currversion self.versionLabel.SetLabel (str (self.currversion))
def __init__(self, parent, *args, **kwds): super(BaseHtmlPanel, self).__init__(parent, *args, **kwds) # Предыдущее содержимое результирующего HTML, чтобы не переписывать # его каждый раз self._oldHtmlResult = u"" # Страница, для которой уже есть сгенерированный HTML self._oldPage = None # Где хранить параметы текущей страницы страницы (код, просмотр и т.д.) self.tabSectionName = u"Misc" self.tabParamName = u"PageIndex" self.imagesDir = getImagesDir() self.notebook = wx.Notebook(self, -1, style=wx.NB_BOTTOM) self._codeEditor = self.getTextEditor()(self.notebook) self.htmlWindow = getOS().getHtmlRender(self.notebook) self.__do_layout() self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self._onTabChanged, self.notebook) self.Bind(self.EVT_SPELL_ON_OFF, handler=self._onSpellOnOff)
def initialize (self): from outwiker.core.system import getImagesDir imagesDir = getImagesDir() self._imageList.Add (wx.Bitmap(os.path.join (imagesDir, "file_icon_default.png"), wx.BITMAP_TYPE_ANY)) self._imageList.Add (wx.Bitmap(os.path.join (imagesDir, "folder.png"), wx.BITMAP_TYPE_ANY))
def _createTitleFormatGUI(self, main_sizer): """ Создать элементы интерфейса, связанные с форматом заголовка главного окна """ hints = [ (u"{file}", _(u"Wiki file name")), (u"{page}", _(u"Page title")), (u"{subpath}", _(u"Relative path to current page")), ] self.titleFormatLabel = wx.StaticText(self, -1, _("Main window title format")) hintBitmap = wx.Bitmap(os.path.join(getImagesDir(), u"wand.png")) self.titleFormatText = FormatCtrl( self, self.mainWindowConfig.titleFormat.value, hints, hintBitmap) self.titleFormatSizer = wx.FlexGridSizer(1, 2, 0, 0) self.titleFormatSizer.Add(self.titleFormatLabel, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) self.titleFormatSizer.Add(self.titleFormatText, 0, wx.ALL | wx.EXPAND, 2) self.titleFormatSizer.AddGrowableCol(1) main_sizer.Add(self.titleFormatSizer, 1, wx.EXPAND, 0)
def __init__(self, parent: 'outwiker.gui.currentpagepanel.CurrentPagePanel', application): super().__init__(parent, application) # Предыдущее содержимое результирующего HTML, чтобы не переписывать # его каждый раз self._oldHtmlResult = "" # Страница, для которой уже есть сгенерированный HTML self._oldPage = None # Где хранить параметы текущей страницы страницы (код, просмотр и т.д.) self.tabParamName = "PageIndex" self._statusbar_item = 0 self.imagesDir = getImagesDir() self.notebook = wx.aui.AuiNotebook(self, style=wx.aui.AUI_NB_BOTTOM) self._codeEditor = self.getTextEditor()(self.notebook) self.htmlWindow = parent.borrowHtmlRender(self.notebook) self.htmlWindow.Show() self.__do_layout() self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self._onTabChanged, self.notebook) self.Bind(self.EVT_SPELL_ON_OFF, handler=self._onSpellOnOff) self._application.onPageUpdate += self._onPageUpdate self._bindHotkeys()
def __init__ (self, parent, defaultFormat, hintsList): """ defaultFormat - значение по умолчанию hintsList - список кортежей. Первый элемент - подстановочный символ, второй элемент - комментарий """ super (FormatCtrl, self).__init__ (parent) # Список кортежей. # Первый элемент - подстановочный символ # Второй элемент - комментарий self._hints = hintsList[:] # Ключ - ID пункта меню, значение - элемент списка self._hints self._menuItemsId = {} self.formatCtrl = wx.TextCtrl (self, -1, defaultFormat) hintBitmap = wx.Bitmap (os.path.join (getImagesDir(), u"wand.png")) self.hintBtn = wx.BitmapButton (self, wx.ID_ANY, hintBitmap) self.__createMenu() self.hintBtn.Bind (wx.EVT_BUTTON, self.__onHintClick) self.hintBtn.Bind (wx.EVT_MENU, self.__onHintMenuClick) self.__layout()
def __init__(self, parent: wx.Window): super().__init__(parent) self._columns = [] # type: List[BaseColumn] self._pages = [] self._defaultIcon = os.path.join(getImagesDir(), "page.png") self._imageList = ImageListCache(self._defaultIcon) self._propagationLevel = 15 self.SetBackgroundColour(wx.Colour(255, 255, 255)) self._sizer = wx.FlexGridSizer(cols=1) self._sizer.AddGrowableCol(0) self._sizer.AddGrowableRow(0) self._listCtrl = ULC.UltimateListCtrl( self, agwStyle=ULC.ULC_REPORT | ULC.ULC_SINGLE_SEL | ULC.ULC_VRULES | ULC.ULC_HRULES | ULC.ULC_SHOW_TOOLTIPS | ULC.ULC_NO_HIGHLIGHT ) self._listCtrl.Bind(ULC.EVT_LIST_ITEM_HYPERLINK, handler=self._onPageClick) self._listCtrl.Bind(ULC.EVT_LIST_COL_CLICK, handler=self._onColClick) self._listCtrl.SetHyperTextNewColour(wx.BLUE) self._listCtrl.SetHyperTextVisitedColour(wx.BLUE) self._listCtrl.AssignImageList(self._imageList.getImageList(), wx.IMAGE_LIST_SMALL) self._sizer.Add(self._listCtrl, flag=wx.EXPAND) self.SetSizer(self._sizer)
def __init__(self, currversion, *args, **kwds): self.imagesDir = getImagesDir() wx.Dialog.__init__(self, *args, **kwds) self.titleLabel = wx.StaticText(self, -1, _("OutWiker")) self.versionTitleLabel = wx.StaticText(self, -1, _("Version:")) self.versionLabel = wx.StaticText(self, -1, "") self.notebook = wx.Notebook(self, -1, style=0) self.aboutPane = wx.Panel(self.notebook, -1) self.logo = wx.StaticBitmap(self.aboutPane, -1, wx.Bitmap(os.path.join (self.imagesDir, "outwiker_64x64.png"), wx.BITMAP_TYPE_ANY)) self.description = wx.StaticText (self.aboutPane, -1, _("OutWiker is personal wiki system and tree notes outliner.")) self.license = wx.StaticText(self.aboutPane, -1, _("License: GPL 3")) self.siteLabel = wx.StaticText(self.aboutPane, -1, _("OutWiker's page:")) self.outwikerUrl = wx.HyperlinkCtrl(self.aboutPane, -1, label=_("http://jenyay.net/Outwiker/English"), url=_("http://jenyay.net/Outwiker/English")) self.contactsPane = wx.Panel(self.notebook, -1) self.email = wx.HyperlinkCtrl(self.contactsPane, -1, label=_(u"*****@*****.**"), url=_(u"mailto:[email protected]")) self.googleplus = wx.HyperlinkCtrl(self.contactsPane, -1, label=_(u"Google+ page"), url=_(u"https://plus.google.com/u/0/b/113404982971748285098/113404982971748285098/posts")) self.facebook = wx.HyperlinkCtrl(self.contactsPane, -1, label=_(u"Facebook page"), url=_(u"http://www.facebook.com/outwiker")) self.livejournal = wx.HyperlinkCtrl(self.contactsPane, -1, label=_(u"Livejournal community"), url=_(u"http://ru-outwiker.livejournal.com/?style=mine")) self.twitter = wx.HyperlinkCtrl(self.contactsPane, -1, label=_(u"Twitter"), url=_(u"https://twitter.com/OutWiker")) self.vkontakte = wx.HyperlinkCtrl(self.contactsPane, -1, label=_(u"Vkontakte group"), url=_(u"http://vk.com/outwiker")) self.okButton = wx.Button(self, wx.ID_OK, "") self.__set_properties() self.__do_layout() self.currversion = currversion self.versionLabel.SetLabel (str (self.currversion))
def create(root, phrase=u"", tags=[], strategy=AllTagsSearchStrategy): """ Создать страницу с поиском. Если страница существует, то сделать ее активной """ title = GlobalSearch.pageTitle number = 1 page = None imagesDir = getImagesDir() while page is None: page = root[title] if page is None: page = SearchPageFactory().create(root, title, []) page.icon = os.path.join(imagesDir, "global_search.png") elif page.getTypeString() != SearchWikiPage.getTypeString(): number += 1 title = u"%s %d" % (GlobalSearch.pageTitle, number) page = None page.phrase = phrase page.searchTags = [tag for tag in tags] page.strategy = strategy page.root.selectedPage = page return page
def __createTitleFormatGui(self): """ Создать элементы интерфейса, связанные с форматом заголовка главного окна """ hints = [ (u"{file}", _(u"Wiki file name")), (u"{page}", _(u"Page title")) ] self.titleFormatLabel = wx.StaticText(self, -1, _("Main window title format")) hintBitmap = wx.Bitmap(os.path.join(getImagesDir(), u"wand.png")) self.titleFormatText = FormatCtrl( self, self.mainWindowConfig.titleFormat.value, hints, hintBitmap) self.titleFormatSizer = wx.FlexGridSizer(1, 2, 0, 0) self.titleFormatSizer.Add(self.titleFormatLabel, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) self.titleFormatSizer.Add(self.titleFormatText, 0, wx.ALL | wx.EXPAND, 2) self.titleFormatSizer.AddGrowableCol(1)
def __init__ (self, parent, auiManager): super (GeneralToolBar, self).__init__(parent, auiManager) self.imagesDir = getImagesDir() self.AddTool(MainId.ID_RELOAD, _("Reload"), wx.Bitmap(os.path.join (self.imagesDir, "reload.png"), wx.BITMAP_TYPE_ANY), _("Reload wiki"), fullUpdate=False) self.AddSeparator() self.AddTool(MainId.ID_ATTACH, _(u"Attach files…"), wx.Bitmap(os.path.join (self.imagesDir, "attach.png"), wx.BITMAP_TYPE_ANY), _(u"Attach files…"), fullUpdate=False) self.AddTool(MainId.ID_GLOBAL_SEARCH, _(u"Global search…"), wx.Bitmap(os.path.join (self.imagesDir, "global_search.png"), wx.BITMAP_TYPE_ANY), _(u"Global search…"), fullUpdate=False) self.AddSeparator() self.Realize()
def __init__(self, parent: 'outwiker.gui.currentpagepanel.CurrentPagePanel', application): super().__init__(parent, application) # Предыдущее содержимое результирующего HTML, чтобы не переписывать # его каждый раз self._oldHtmlResult = u"" # Страница, для которой уже есть сгенерированный HTML self._oldPage = None # Где хранить параметы текущей страницы страницы (код, просмотр и т.д.) self.tabParamName = u"PageIndex" self._statusbar_item = 0 self.imagesDir = getImagesDir() self.notebook = wx.aui.AuiNotebook(self, style=wx.aui.AUI_NB_BOTTOM) self._codeEditor = self.getTextEditor()(self.notebook) self.htmlWindow = parent.borrowHtmlRender(self.notebook) self.htmlWindow.Show() self.__do_layout() self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self._onTabChanged, self.notebook) self.Bind(self.EVT_SPELL_ON_OFF, handler=self._onSpellOnOff) self._application.onPageUpdate += self._onPageUpdate
def __init__ (self, parent, *args, **kwds): super (BaseTextPanel, self).__init__ (parent, *args, **kwds) self._application = Application self.searchMenu = None # Предыдущее сохраненное состояние. # Используется для выявления изменения страницы внешними средствами self._oldContent = None # Диалог, который показывается, если страница изменена сторонними программами. # Используется для проверки того, что диалог уже показан и еще раз его показывать не надо self.externalEditDialog = None self.searchMenuIndex = 2 self.imagesDir = getImagesDir() self._spellOnOffEvent, self.EVT_SPELL_ON_OFF = wx.lib.newevent.NewEvent() self._addSearchTools () self._addSpellTools () self._application.onAttachmentPaste += self.onAttachmentPaste self._application.onPreferencesDialogClose += self.onPreferencesDialogClose self._onSetPage += self.__onSetPage
def __createToolsMenu(self): imagesDir = getImagesDir() toolbar = Application.mainWindow.mainToolbar menu = Application.mainWindow.mainMenu.toolsMenu actionController = Application.actionController actionController.appendMenuItem(AddTabAction.stringId, menu) actionController.appendMenuItem(CloseTabAction.stringId, menu) actionController.appendMenuItem(PreviousTabAction.stringId, menu) actionController.appendMenuItem(NextTabAction.stringId, menu) menu.AppendSeparator() actionController.appendMenuItem(GlobalSearchAction.stringId, menu) actionController.appendToolbarButton( GlobalSearchAction.stringId, toolbar, os.path.join(imagesDir, u"global_search.png"), True) actionController.appendMenuItem(AttachFilesAction.stringId, menu) actionController.appendToolbarButton( AttachFilesAction.stringId, toolbar, os.path.join(imagesDir, u"attach.png"), True) menu.AppendSeparator() actionController.appendMenuItem(clipboard.CopyPageTitleAction.stringId, menu) actionController.appendMenuItem(clipboard.CopyPagePathAction.stringId, menu) actionController.appendMenuItem( clipboard.CopyAttachPathAction.stringId, menu) actionController.appendMenuItem(clipboard.CopyPageLinkAction.stringId, menu) actionController.appendMenuItem(OpenAttachFolderAction.stringId, menu) menu.AppendSeparator() actionController.appendMenuItem(tags.AddTagsToBranchAction.stringId, menu) actionController.appendMenuItem( tags.RemoveTagsFromBranchAction.stringId, menu) actionController.appendMenuItem(tags.RenameTagAction.stringId, menu) menu.AppendSeparator() actionController.appendMenuItem(ReloadWikiAction.stringId, menu) actionController.appendMenuItem(SetStyleToBranchAction.stringId, menu)
def __init__(self, application): self._application = application self._addedWebPageMenuItems = False self.imagesDir = getImagesDir() self._MENU_INDEX = 5 self._menuName = None self._menu = None
def _createTreeMenu(self): """ Заполнить действиями меню Дерево """ actionController = self._application.actionController menu = self.menuController[guidefines.MENU_TREE] toolbar = self.toolbars[guidefines.TOOLBAR_GENERAL] imagesDir = getImagesDir() actionController.appendMenuItem(HistoryBackAction.stringId, menu) actionController.appendToolbarButton( HistoryBackAction.stringId, toolbar, os.path.join(imagesDir, u"back.png"), True) actionController.enableTools(HistoryBackAction.stringId, False) actionController.appendMenuItem(HistoryForwardAction.stringId, menu) actionController.appendToolbarButton( HistoryForwardAction.stringId, toolbar, os.path.join(imagesDir, u"forward.png"), True) actionController.enableTools(HistoryForwardAction.stringId, False) toolbar.AddSeparator() menu.AppendSeparator() actionController.appendMenuItem(AddSiblingPageAction.stringId, menu) actionController.appendMenuItem(AddChildPageAction.stringId, menu) menu.AppendSeparator() actionController.appendMenuItem(MovePageUpAction.stringId, menu) actionController.appendMenuItem(MovePageDownAction.stringId, menu) actionController.appendMenuItem(SortChildAlphabeticalAction.stringId, menu) actionController.appendMenuItem( SortSiblingsAlphabeticalAction.stringId, menu) menu.AppendSeparator() actionController.appendMenuItem(GoToParentAction.stringId, menu) actionController.appendMenuItem(GoToFirstChildAction.stringId, menu) actionController.appendMenuItem(GoToPrevSiblingAction.stringId, menu) actionController.appendMenuItem(GoToNextSiblingAction.stringId, menu) menu.AppendSeparator() actionController.appendMenuItem(RenamePageAction.stringId, menu) actionController.appendMenuItem(RemovePageAction.stringId, menu) menu.AppendSeparator() actionController.appendMenuItem(EditPagePropertiesAction.stringId, menu)
def _createControls(self): self._createButtons() self._createFileInfoPanels() self.textLabel = wx.StaticText(self, label=_("Overwrite file?"), style=wx.ALIGN_CENTRE) downArrowBmp = wx.Image(os.path.join( getImagesDir(), 'arrow_down.png')).ConvertToBitmap() self._downArrow = wx.StaticBitmap(self, bitmap=downArrowBmp)
def __init__(self, application, mainWnd): super(TrayIconWindows, self).__init__() self._application = application self.mainWnd = mainWnd self.ID_RESTORE = wx.NewId() self.ID_EXIT = wx.NewId() self.icon = wx.Icon(os.path.join(getImagesDir(), "outwiker.ico"), wx.BITMAP_TYPE_ANY)
def initialize(self): from outwiker.core.system import getImagesDir imagesDir = getImagesDir() self._imageList.Add( wx.Bitmap(os.path.join(imagesDir, "file_icon_default.png"), wx.BITMAP_TYPE_ANY)) self._imageList.Add( wx.Bitmap(os.path.join(imagesDir, "folder.png"), wx.BITMAP_TYPE_ANY))
def getTrayIconController(application, parentWnd): if os.name == "nt": fname = 'outwiker_16x16.png' else: fname = 'outwiker_64x64.png' return TrayIconController(application, parentWnd, os.path.join(getImagesDir(), fname))
def _addRecentIconsGroup(self, group_info_list): recent_title = _(u'Recent') recent_cover = os.path.join(getImagesDir(), u'recent.png') recent_icons = self._recentIconsList.getRecentIcons() group_info_list.insert(0, IconsGroupInfo(recent_icons, recent_title, recent_cover, sort_key=None) )
def _setIcon(self): """ Установки иконки главного окна """ icon = wx.Icon() icon.CopyFromBitmap( wx.Bitmap(os.path.join(getImagesDir(), "outwiker.ico"), wx.BITMAP_TYPE_ANY)) self.SetIcon(icon)
def __setIcon (self): """ Установки иконки главного окна """ icon = wx.EmptyIcon() icon.CopyFromBitmap(wx.Bitmap(os.path.join (getImagesDir(), "outwiker.ico"), wx.BITMAP_TYPE_ANY)) self.SetIcon(icon)
def _addRecentIconsGroup(self, group_info_list): recent_title = _(u'Recent') recent_cover = os.path.join(getImagesDir(), u'recent.png') recent_icons = self._recentIconsList.getRecentIcons() group_info_list.insert(0, IconsGroupInfo( recent_icons, recent_title, recent_cover, group_type=IconsGroupInfo.TYPE_OTHER, sort_key=None) )
def __getSystemIcon (self, ext): """ Получить картинку по расширению или None, если такой картинки нет """ iconfolder = "fileicons" from outwiker.core.system import getImagesDir iconpath = os.path.join (getImagesDir(), iconfolder) filename = u"file_extension_{}.png".format (ext) imagePath = os.path.join (iconpath, filename) if os.path.exists (imagePath): return wx.Bitmap (imagePath, wx.BITMAP_TYPE_ANY) return None
def __getSystemIcon(self, ext): """ Получить картинку по расширению или None, если такой картинки нет """ iconfolder = "fileicons" from outwiker.core.system import getImagesDir iconpath = os.path.join(getImagesDir(), iconfolder) filename = u"file_extension_{}.png".format(ext) imagePath = os.path.join(iconpath, filename) if os.path.exists(imagePath): return wx.Bitmap(imagePath, wx.BITMAP_TYPE_ANY) return None
def __createToolBar(self, parent, id): imagesDir = getImagesDir() toolbar = wx.ToolBar(parent, id, style=wx.TB_DOCKABLE) toolbar.AddLabelTool( self.ID_REFRESH, _(u"Refresh"), wx.Bitmap(os.path.join(imagesDir, "reload.png"), wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Refresh"), "") toolbar.AddSeparator() toolbar.AddLabelTool( self.ID_ATTACH, _(u"Attach Files…"), wx.Bitmap(os.path.join(imagesDir, "attach.png"), wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Attach Files…"), "") toolbar.AddLabelTool( self.ID_REMOVE, _(u"Remove Files…"), wx.Bitmap(os.path.join(imagesDir, "delete.png"), wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Remove Files…"), "") toolbar.AddSeparator() toolbar.AddLabelTool( self.ID_PASTE, _(u"Paste"), wx.Bitmap(os.path.join(imagesDir, "paste.png"), wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Paste"), "") toolbar.AddLabelTool( self.ID_EXECUTE, _(u"Execute"), wx.Bitmap(os.path.join(imagesDir, "execute.png"), wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Execute"), "") toolbar.AddLabelTool( self.ID_OPEN_FOLDER, _(u"Open Attachments Folder"), wx.Bitmap(os.path.join(imagesDir, "folder.png"), wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Open Attachments Folder"), "") toolbar.Realize() return toolbar
def __createGui(self): mainSizer = wx.FlexGridSizer(cols=1) mainSizer.AddGrowableCol(0) mainSizer.AddGrowableRow(1) mainSizer.AddGrowableRow(2) self._messageCtrl = wx.StaticText(self, -1, u'') hintBitmap = wx.Bitmap(os.path.join(getImagesDir(), u"wand.png")) self._formatCtrl = DateTimeFormatCtrl(self, hintBitmap) self._formatCtrl.SetMinSize((300, -1)) okCancel = self.CreateButtonSizer(wx.OK | wx.CANCEL) mainSizer.Add(self._messageCtrl, 1, wx.ALL, border=2) mainSizer.Add(self._formatCtrl, 1, wx.ALL | wx.EXPAND, border=2) mainSizer.Add(okCancel, 1, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM, border=2) self.SetSizer(mainSizer)
def _createFileMenu(self): """ Заполнить действиями меню Файл """ imagesDir = getImagesDir() toolbar = self.toolbars[guidefines.TOOLBAR_GENERAL] menu = self.menuController[guidefines.MENU_FILE] actionController = self._application.actionController # Создать... actionController.appendMenuItem(NewAction.stringId, menu) actionController.appendToolbarButton( NewAction.stringId, toolbar, os.path.join(imagesDir, u"new.png"), True) # Открыть... actionController.appendMenuItem(OpenAction.stringId, menu) actionController.appendToolbarButton( OpenAction.stringId, toolbar, os.path.join(imagesDir, u"open.png"), True) # Открыть только для чтения actionController.appendMenuItem(OpenReadOnlyAction.stringId, menu) menu.AppendSeparator() toolbar.AddSeparator() # Закрыть actionController.appendMenuItem(CloseAction.stringId, menu) # Сохранить actionController.appendMenuItem(SaveAction.stringId, menu) menu.AppendSeparator() # Печать actionController.appendMenuItem(PrintAction.stringId, menu) # Выход actionController.appendMenuItem(ExitAction.stringId, menu) menu.AppendSeparator()
def __createFileMenu(self): """ Заполнить действиями меню Файл """ imagesDir = getImagesDir() toolbar = Application.mainWindow.mainToolbar menu = Application.mainWindow.mainMenu.fileMenu actionController = Application.actionController # Создать... actionController.appendMenuItem(NewAction.stringId, menu) actionController.appendToolbarButton( NewAction.stringId, toolbar, os.path.join(imagesDir, u"new.png"), True) # Открыть... actionController.appendMenuItem(OpenAction.stringId, menu) actionController.appendToolbarButton( OpenAction.stringId, toolbar, os.path.join(imagesDir, u"open.png"), True) # Открыть только для чтения actionController.appendMenuItem(OpenReadOnlyAction.stringId, menu) menu.AppendSeparator() toolbar.AddSeparator() # Закрыть actionController.appendMenuItem(CloseAction.stringId, menu) # Сохранить actionController.appendMenuItem(SaveAction.stringId, menu) menu.AppendSeparator() # Печать actionController.appendMenuItem(PrintAction.stringId, menu) # Выход actionController.appendMenuItem(ExitAction.stringId, menu) menu.AppendSeparator()
def __init__(self, parent): super(TagsSelector, self).__init__(parent) self.__tagsWidth = 350 self.__tagsHeight = 150 self.__tagBitmap = wx.Bitmap(os.path.join(getImagesDir(), "tag.png"), wx.BITMAP_TYPE_PNG) self.label_tags = wx.StaticText(self, -1, _(u"Tags (comma separated)")) self.tagsTextCtrl = wx.TextCtrl(self, -1, "") self.tagsTextCtrl.SetMinSize((250, -1)) self.__tagsCloud = TagsCloud(self) self.__tagsCloud.SetMinSize((self.__tagsWidth, self.__tagsHeight)) self.__tagsCloud.Bind(EVT_TAG_LEFT_CLICK, self.__onTagClick) self.tagsTextCtrl.Bind(wx.EVT_TEXT, handler=self.__onTagsChanged) self.__layout()
def __init__ (self, parent): super (TagsSelector, self).__init__ (parent) self.__tagsWidth = 350 self.__tagsHeight = 150 self.__tagBitmap = wx.Bitmap (os.path.join (getImagesDir(), "tag.png"), wx.BITMAP_TYPE_PNG) self.label_tags = wx.StaticText(self, -1, _(u"Tags (comma separated)")) self.tagsTextCtrl = wx.TextCtrl(self, -1, "") self.tagsTextCtrl.SetMinSize((250, -1)) self.__tagsCloud = TagsCloud (self) self.__tagsCloud.SetMinSize ((self.__tagsWidth, self.__tagsHeight)) self.__tagsCloud.Bind (EVT_TAG_LEFT_CLICK, self.__onTagClick) self.tagsTextCtrl.Bind (wx.EVT_TEXT, handler=self.__onTagsChanged) self.__layout()
def __init__(self, parent, *args, **kwds): super (BaseHtmlPanel, self).__init__ (parent, *args, **kwds) self._htmlFile = "__content.html" self.currentHtmlFile = None # Где хранить параметы текущей страницы страницы (код, просмотр и т.д.) self.tabSectionName = u"Misc" self.tabParamName = u"PageIndex" self.imagesDir = getImagesDir() self.notebook = wx.Notebook(self, -1, style=wx.NB_BOTTOM) self._codeEditor = self.GetTextEditor()(self.notebook) self.htmlWindow = getHtmlRender (self.notebook) self.__do_layout() self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onTabChanged, self.notebook) self.Bind (wx.EVT_CLOSE, self.onClose)
def _createGui(self): # Поле для ввода искомой фразы self._searchText = wx.TextCtrl(self, -1, u"", style=wx.TE_PROCESS_ENTER) # Текст для замены self._replaceText = wx.TextCtrl(self, -1, u"", style=wx.TE_PROCESS_ENTER) # Элементы интерфейса, связанные с поиском self._findLabel = wx.StaticText(self, -1, _(u"Find what: ")) # Кнопка "Найти далее" self._nextSearchBtn = wx.Button(self, -1, _(u"Next")) # Кнопка "Найти выше" self._prevSearchBtn = wx.Button(self, -1, _(u"Prev")) # Метка с результатом поиска self._resultLabel = wx.StaticText(self, -1, "") self._resultLabel.SetMinSize((150, -1)) # Элементы интерфейса, связанные с заменой self._replaceLabel = wx.StaticText(self, -1, _(u"Replace with: ")) # Кнопка "Заменить" self._replaceBtn = wx.Button(self, -1, _(u"Replace")) # Кнопка "Заменить все" self._replaceAllBtn = wx.Button(self, -1, _(u"Replace All")) self._closeBtn = wx.BitmapButton( self, -1, wx.Bitmap(os.path.join(getImagesDir(), "close-button.png"), wx.BITMAP_TYPE_ANY)) self._layout()
def __init__(self, parent): super(type(self), self).__init__(parent) self._default_group_cover = os.path.join(getImagesDir(), u'icons_cover_default.png') self.__createGuiElements() self._groups.Bind(wx.EVT_TREE_SEL_CHANGED, handler=self.__onGroupSelect) self._groups.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.__onBeginLabelEdit) self._groups.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.__onEndLabelEdit) self._groups.Bind(wx.EVT_KEY_DOWN, handler=self.__onKeyDown) self.__updateGroups() self.SetupScrolling()
def __init__(self, application, mainWnd): import gtk import appindicator self._application = application self._mainWnd = mainWnd self._icon = os.path.abspath( os.path.join(getImagesDir(), "outwiker_64x64.png")) assert os.path.exists(self._icon) self._indicator = appindicator.Indicator( "OutWiker", self._icon, appindicator.CATEGORY_APPLICATION_STATUS) menu = gtk.Menu() self.restoreMenuItem = gtk.MenuItem(_('Restore')) self.restoreMenuItem.show() self.exitMenuItem = gtk.MenuItem(_('Exit')) self.exitMenuItem.show() menu.append(self.restoreMenuItem) menu.append(self.exitMenuItem) self._indicator.set_menu(menu)
def _createGui (self): # Поле для ввода искомой фразы self._searchText = wx.TextCtrl (self, -1, u"", style=wx.TE_PROCESS_ENTER) # Текст для замены self._replaceText = wx.TextCtrl (self, -1, u"", style=wx.TE_PROCESS_ENTER) # Элементы интерфейса, связанные с поиском self._findLabel = wx.StaticText(self, -1, _(u"Find what: ")) # Кнопка "Найти далее" self._nextSearchBtn = wx.Button (self, -1, _(u"Next")) # Кнопка "Найти выше" self._prevSearchBtn = wx.Button (self, -1, _(u"Prev")) # Метка с результатом поиска self._resultLabel = wx.StaticText(self, -1, "") self._resultLabel.SetMinSize ((150, -1)) # Элементы интерфейса, связанные с заменой self._replaceLabel = wx.StaticText(self, -1, _(u"Replace with: ")) # Кнопка "Заменить" self._replaceBtn = wx.Button (self, -1, _(u"Replace")) # Кнопка "Заменить все" self._replaceAllBtn = wx.Button (self, -1, _(u"Replace All")) self._closeBtn = wx.BitmapButton ( self, -1, wx.Bitmap(os.path.join (getImagesDir(), "close-button.png"), wx.BITMAP_TYPE_ANY)) self._layout()
def __onIconsGroupsListInit(self, page, params): if not self._enableOnIconsGroupsListInit: return images_dir = getImagesDir() iconslist = [ os.path.join(images_dir, u'add.png'), os.path.join(images_dir, u'code.png'), os.path.join(images_dir, u'save.png'), ] title = u'__Debug group__' cover = None group_type = IconsGroupInfo.TYPE_OTHER sort_key = None newgroup = IconsGroupInfo(iconslist=iconslist, title=title, cover=cover, group_type=group_type, sort_key=sort_key) params.groupsList.insert(0, newgroup)
def __createDateTimeFormatGui(self, generalConfig): """ Создать элементы, связанные с выбором формата даты и времени """ initial = generalConfig.dateTimeFormat.value dateTimeLabel = wx.StaticText(self, -1, _("Date and time format")) hintBitmap = wx.Bitmap(os.path.join(getImagesDir(), u"wand.png")) self.dateTimeFormatCtrl = DateTimeFormatCtrl(self, hintBitmap, initial) self.dateTimeSizer = wx.FlexGridSizer(1, 2, 0, 0) self.dateTimeSizer.AddGrowableRow(0) self.dateTimeSizer.AddGrowableCol(1) self.dateTimeSizer.Add(dateTimeLabel, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, border=2) self.dateTimeSizer.Add(self.dateTimeFormatCtrl, 0, wx.ALL | wx.EXPAND, border=2)
def __init__ (self, parent, multiselect=False): wx.ScrolledWindow.__init__ (self, parent, style = wx.BORDER_THEME) self.cellWidth = 32 self.cellHeight = 32 self.margin = 1 self.multiselect = multiselect # Path to current page icon self._currentIcon = None self._lastClickedButton = None self.SetScrollRate (0, 0) self.SetBackgroundColour (wx.Colour (255, 255, 255)) # Список картинок, которые хранятся в окне self.buttons = [] self.defaultIcon = os.path.join (getImagesDir(), "page.png") self.Bind (wx.EVT_SIZE, self.__onSize)
def __init__(self, application, mainWnd): import gtk import appindicator self._application = application self._mainWnd = mainWnd self._icon = os.path.abspath(os.path.join(getImagesDir(), "outwiker_64x64.png")) assert os.path.exists(self._icon) self._indicator = appindicator.Indicator("OutWiker", self._icon, appindicator.CATEGORY_APPLICATION_STATUS) menu = gtk.Menu() self.restoreMenuItem = gtk.MenuItem(_('Restore')) self.restoreMenuItem.show() self.exitMenuItem = gtk.MenuItem(_('Exit')) self.exitMenuItem.show() menu.append(self.restoreMenuItem) menu.append(self.exitMenuItem) self._indicator.set_menu(menu)
def __init__(self, parent, *args, **kwds): super (BaseHtmlPanel, self).__init__ (parent, *args, **kwds) # Предыдущее содержимое результирующего HTML, чтобы не переписывать # его каждый раз self._oldHtmlResult = u"" # Страница, для которой уже есть сгенерированный HTML self._oldPage = None # Где хранить параметы текущей страницы страницы (код, просмотр и т.д.) self.tabSectionName = u"Misc" self.tabParamName = u"PageIndex" self.imagesDir = getImagesDir() self.notebook = wx.Notebook(self, -1, style=wx.NB_BOTTOM) self._codeEditor = self.getTextEditor()(self.notebook) self.htmlWindow = getOS().getHtmlRender (self.notebook) self.__do_layout() self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self._onTabChanged, self.notebook) self.Bind (self.EVT_SPELL_ON_OFF, handler=self._onSpellOnOff)
def __createToolsMenu (self): imagesDir = getImagesDir() toolbar = Application.mainWindow.mainToolbar menu = Application.mainWindow.mainMenu.toolsMenu actionController = Application.actionController actionController.appendMenuItem ( AddTabAction.stringId, menu) actionController.appendMenuItem ( CloseTabAction.stringId, menu) actionController.appendMenuItem ( PreviousTabAction.stringId, menu) actionController.appendMenuItem ( NextTabAction.stringId, menu) menu.AppendSeparator() actionController.appendMenuItem ( GlobalSearchAction.stringId, menu) actionController.appendToolbarButton (GlobalSearchAction.stringId, toolbar, os.path.join (imagesDir, u"global_search.png"), True) actionController.appendMenuItem ( AttachFilesAction.stringId, menu) actionController.appendToolbarButton (AttachFilesAction.stringId, toolbar, os.path.join (imagesDir, u"attach.png"), True) menu.AppendSeparator() actionController.appendMenuItem ( clipboard.CopyPageTitleAction.stringId, menu) actionController.appendMenuItem ( clipboard.CopyPagePathAction.stringId, menu) actionController.appendMenuItem ( clipboard.CopyAttachPathAction.stringId, menu) actionController.appendMenuItem ( clipboard.CopyPageLinkAction.stringId, menu) menu.AppendSeparator() actionController.appendMenuItem ( tags.AddTagsToBranchAction.stringId, menu) actionController.appendMenuItem ( tags.RemoveTagsFromBranchAction.stringId, menu) actionController.appendMenuItem ( tags.RenameTagAction.stringId, menu) menu.AppendSeparator() actionController.appendMenuItem ( ReloadWikiAction.stringId, menu)