Ejemplo n.º 1
0
def main(args=sys.argv):
    if len(args) < 2:
        print __doc__
        return

    args = args[1:]
    cachedir = None
    if args[0][:7] == '--cache':
        cachedir = os.path.expanduser(args[0].split('=')[1])
        args = args[1:]

    if len(args) == 0:
        print __doc__
        return

    app = wx.PySimpleApp()
    #wx.Log.SetActiveTarget(wx.LogStderr())
    wx.Log.SetLogLevel(wx.LOG_Error)

    # Set up the default config so the htmlhelp frame can save its preferences
    app.SetVendorName('wxWindows')
    app.SetAppName('helpviewer')
    cfg = wx.ConfigBase.Get()

    # Add the Zip filesystem
    wx.FileSystem.AddHandler(wx.ZipFSHandler())

    helpctrl = makeHelpViewer(args,cachedir)

    # start it up!
    helpctrl.DisplayContents()
    
    app.MainLoop()
Ejemplo n.º 2
0
 def setuphelp(self):
     """Does all the nonsense to get help working"""
     import wx.html
     # Add the Zip filesystem
     wx.FileSystem_AddHandler(wx.ZipFSHandler())
     # Get the help working
     self.helpcontroller=wx.html.HtmlHelpController()
     self.helpcontroller.AddBook(guihelper.getresourcefile("bitpim.htb"))
     self.helpcontroller.UseConfig(self.config, "help")
Ejemplo n.º 3
0
def main(args=sys.argv):
    if len(args) < 2:
        print __doc__
        return

    args = args[1:]
    if args[0] == '--help':
        print __doc__
        return

    cachedir = None
    if args[0][:7] == '--cache':
        cachedir = os.path.expanduser(args[0].split('=')[1])
        args = args[1:]

    if len(args) == 0:
        print __doc__
        return

    import wx
    import wx.html

    app = wx.PySimpleApp()
    #wx.Log.SetActiveTarget(wx.LogStderr())
    wx.Log.SetLogLevel(wx.LOG_Error)

    # Set up the default config so the htmlhelp frame can save its preferences
    app.SetVendorName('wxWidgets')
    app.SetAppName('helpviewer')
    cfg = wx.ConfigBase.Get()

    # Add the Zip filesystem
    wx.FileSystem.AddHandler(wx.ZipFSHandler())

    # Create the viewer
    helpctrl = wx.html.HtmlHelpController()
    if cachedir:
        helpctrl.SetTempDir(cachedir)

    # and add the books
    for helpfile in args:
        print "Adding %s..." % helpfile
        helpctrl.AddBook(helpfile, 1)

    # The frame used by the HtmlHelpController is set to not prevent
    # app exit, so in the case of a standalone helpviewer like this
    # when the about box or search box is closed the help frame will
    # be the only one left and the app will close unexpectedly.  To
    # work around this we'll create another frame that is never shown,
    # but which will be closed when the helpviewer frame is closed.
    wx.CallAfter(makeOtherFrame, helpctrl)

    # start it up!
    helpctrl.DisplayContents()
    app.MainLoop()
Ejemplo n.º 4
0
def main(args=sys.argv):
    if len(args) < 2:
        print __doc__
        return

    args = args[1:]
    cachedir = None
    if args[0][:7] == '--cache':
        cachedir = os.path.expanduser(args[0].split('=')[1])
        args = args[1:]

    if len(args) == 0:
        print __doc__
        return

    import wx
    import wx.html

    app = wx.PySimpleApp()
    #wx.Log.SetActiveTarget(wx.LogStderr())
    wx.Log.SetLogLevel(wx.LOG_Error)

    # Set up the default config so the htmlhelp frame can save its preferences
    app.SetVendorName('wxWindows')
    app.SetAppName('helpviewer')
    cfg = wx.ConfigBase.Get()

    # Add the Zip filesystem
    wx.FileSystem.AddHandler(wx.ZipFSHandler())

    # Create the viewer
    helpctrl = wx.html.HtmlHelpController()
    if cachedir:
        helpctrl.SetTempDir(cachedir)

    # and add the books
    for helpfile in args:
        print "Adding %s..." % helpfile
        helpctrl.AddBook(helpfile, 1)

    # start it up!
    helpctrl.DisplayContents()
    app.MainLoop()
Ejemplo n.º 5
0
def getHelpController():
    if not _hc:
        initHelp()
    return _hc


def getCacheDir():
    cacheDir = os.path.join(Preferences.rcPath, 'docs-cache')
    if not os.path.isdir(cacheDir):
        cacheDir = os.path.join(Preferences.pyPath, 'Docs', 'cache')
    return cacheDir


# needed for .htb files
wx.FileSystem.AddHandler(wx.ZipFSHandler())

use_standard_controller = False


def initHelp(calledAtStartup=False):
    jn = os.path.join
    docsDir = jn(Preferences.pyPath, 'Docs')

    global _hc
    if use_standard_controller:
        _hc = wx.html.HtmlHelpController(wxHF_ICONS_BOOK_CHAPTER | \
            wxHF_DEFAULT_STYLE | (Preferences.flatTools and wxHF_FLAT_TOOLBAR or 0))
    else:
        _hc = wxHtmlHelpControllerEx(wxHF_ICONS_BOOK | \
            wxHF_DEFAULT_STYLE | (Preferences.flatTools and wxHF_FLAT_TOOLBAR or 0))