예제 #1
0
    def __init__(self, parent):
        super(View, self).__init__(parent,
                                   -1,
                                   title=_('Search'),
                                   style=wx.CAPTION | wx.NO_BORDER)

        self._parent = parent
        self._bookmarkMenu = None

        self.SetBackgroundColour(wx.Colour(0xED, 0xED, 0xED, 0xFF))

        self._resultsWindow = widgets.ResultsWindow(self)
        self._resultsWindow.SetPage(
            u'<html><body bgcolor="%s"></body></html>' %
            (utils.LoadThemeBackgroundHex(constants.SEARCH)))

        self._font = utils.LoadFont(constants.SEARCH_FONT)
        if self._font and self._font.IsOk():
            self._resultsWindow.SetStandardFonts(self._font.GetPointSize(),
                                                 self._font.GetFaceName())

        self._topBar = widgets.SearchToolPanel(self, self._font)

        self.SetCenterPane(self._resultsWindow)
        info = aui.AuiPaneInfo().CloseButton(False).Resizable(
            False).CaptionVisible(False)
        info = info.FloatingSize((720, 125)).MinSize((720, 125)).Top()
        self.AddPane(self._topBar, info)

        self._CreateHistoryListPane()
예제 #2
0
 def Create(parent, code, index, font, delegate, mainWindow=False):
     if code == constants.THAI_FIVE_BOOKS_CODE or code == constants.THAI_POCKET_BOOK_CODE:
         return widgets.ReadWithReferencesPanel(
             parent, code if not mainWindow else None, index, font,
             delegate)
     font = utils.LoadFont(constants.READ_FONT, code)
     return widgets.ReadPanel(parent, code if not mainWindow else None,
                              index, font, delegate)
예제 #3
0
 def GetBookList(self, parent=None):
     tree = wx.TreeCtrl(parent if parent else self._parent,
                        wx.ID_ANY,
                        wx.DefaultPosition,
                        wx.DefaultSize,
                        style=wx.TR_HIDE_ROOT | wx.TR_HAS_BUTTONS)
     font = utils.LoadFont(constants.READ_FONT, self._code)
     tree.SetFont(font)
     self._InitTree(None, tree)
     return tree
예제 #4
0
    def __init__(self, parent, title, code):
        super(View, self).__init__(parent,
                                   wx.ID_ANY,
                                   title=title,
                                   style=wx.CAPTION)

        self._dataSource = None
        self._delegate = None
        self._parent = parent

        self._components = ViewComponentsCreator.Create(code, self)
        self._code = code
        self._readPanel = None
        self._comparePanel = {}

        self._font = utils.LoadFont(constants.READ_FONT, code)

        self._bookmarkMenu = None
        self.SetBackgroundColour(wx.Colour(0xED, 0xED, 0xED, 0xFF))
예제 #5
0
 def ShowFontDialog(self):
     curFont = utils.LoadFont(constants.SEARCH_FONT)
     fontData = wx.FontData()
     fontData.EnableEffects(False)
     if curFont != None:
         fontData.SetInitialFont(curFont)
     dialog = SimpleFontDialog(self._view, fontData) if 'wxMac' in wx.PlatformInfo else wx.FontDialog(self._view, fontData)
     if dialog.ShowModal() == wx.ID_OK:
         data = dialog.GetFontData()
         font = data.GetChosenFont()
         if font.IsOk():
             utils.SaveFont(font, constants.SEARCH_FONT)
             self._view.Font = font
             if 'wxMac' not in wx.PlatformInfo:
                 size = font.GetPointSize()
                 font.SetPointSize(16)
                 self._view.SearchCtrl.SetFont(font)
                 font.SetPointSize(size)
             self._view.ResultsWindow.SetStandardFonts(font.GetPointSize(),font.GetFaceName())
     dialog.Destroy()
예제 #6
0
    def GetBookList(self, parent=None):
        choices = []
        for item in self._dataSource.GetBookListItems():

            if self._code in [
                    constants.THAI_POCKET_BOOK_CODE,
                    constants.ROMAN_SCRIPT_CODE
            ]:
                choices.append(item)
            else:
                tokens = item.split()
                choice = tokens[0] + ' ' + ' '.join(
                    tokens[2:]) + ' ' + tokens[1]
                choices.append(choice)

        bookList = wx.ListBox(parent if parent else self._parent,
                              wx.ID_ANY,
                              choices=choices,
                              style=wx.LB_SINGLE | wx.NO_BORDER)
        font = utils.LoadFont(constants.BOOK_FONT, self._code)
        bookList.SetFont(font)
        bookList.SetSelection(0)
        return bookList