Esempio n. 1
0
  def __init__(self):
    # log start
    initTs = time.clock()
    self.startupTimeStamp = time.time()

    # parse startup arguments
    start = startup.Startup()
    args = start.args
    self.args = args

    # restore the persistent options dictionary
    self.d = {}
    self.options = options.Options(self)
    # options value watching
    self.maxWatchId = 0
    self.watches = {}

    initialSize = (854, 480)

    # get the platform module
    self.platform = None
    # get the platform ID string
    platformId = "harmattan" # safe fallback
    if args.p is None:
      import platform_detection
      # platform detection
      result = platform_detection.getBestPlatformModuleId()
      if result:
        platformId = result
    else: # use the CLI provided value
      platformId = args.p

    if platformId == "harmattan":
      import harmattan

      self.platform = harmattan.Harmattan(self)
    else:
      print("can't start: current platform unknown")
      sys.exit(1)

    # create the GUI
    startTs1 = timer.start()

    # Panora currently has only a single QML based GUI module
    self.gui = gui.getGui(self, 'QML', accel=True, size=initialSize)

    timer.elapsed(startTs1, "GUI module import")
    timer.elapsed(initTs, "Init")
    timer.elapsed(startTs, "Complete startup")

    # start the main loop
    self.gui.startMainLoop()
Esempio n. 2
0
    def __init__(self):
        # log start
        initTs = time.clock()
        self.startupTimeStamp = time.time()

        # parse startup arguments
        start = startup.Startup()
        args = start.args
        self.args = args
        self.originalCWD = originalCWD

        # restore the persistent options dictionary
        self.d = {}
        self.options = options.Options(self)
        # options value watching
        self.maxWatchId = 0
        self.watches = {}
        # history lock
        self.historyLock = RLock()  # NOTE: not yet used

        # enable stats
        self.stats = stats.Stats(self)

        self.continuousReading = True

        # get the platform module
        self.platform = None

        # get the platform ID string
        platformId = "pc"  # safe fallback
        if args.p is None:
            import platform_detection
            # platform detection
            result = platform_detection.getBestPlatformModuleId()
            if result:
                platformId = result
        else:  # use the CLI provided value
            platformId = args.p

        if platformId:
            if platformId == "maemo5":
                import maemo5

                if args.u == "hildon":  # enable app menu with Hildon gui
                    self.platform = maemo5.Maemo5(self, GTK=True)
                else:
                    self.platform = maemo5.Maemo5(self, GTK=False)
            elif platformId == "harmattan":
                import harmattan

                self.platform = harmattan.Harmattan(self)
            else:
                import pc

                self.platform = pc.PC(self)

        else:
            # no platform provided, decide based on selected GUI
            if args.u == "hildon":
                import maemo5

                self.platform = maemo5.Maemo5(self, GTK=True)
            elif args.u == "harmattan":
                import harmattan

                self.platform = harmattan.Harmattan(self)
            else:
                import pc

                self.platform = pc.PC(self)

        # create the GUI
        startTs1 = timer.start()

        # use CLI provided GUI module ID
        if args.u:
            self._loadGUIModule(args.u)
        else:  # get GUI module id from the platform module
            ids = self.platform.getSupportedGUIModuleIds()
            if ids:
                guiModuleId = ids[0]
                print('preferred GUI ID from platform module: %s' %
                      guiModuleId)
                self._loadGUIModule(guiModuleId)
            else:
                print(
                    "platform module error: list of supported GUI IDs is empty"
                )

        timer.elapsed(startTs1, "GUI module import")

        #    # resize the viewport when window size changes
        #    self.gui.resizeNotify(self._resizeViewport)

        self.activeManga = None

        # check if a path was specified in the startup arguments
        if args.o is not None:
            try:
                print("loading manga from: %s" % args.o)
                self.setActiveManga(self.openManga(args.o, checkHistory=True))
                print('manga loaded')
            except Exception, e:
                print("loading manga from path: %s failed" % args.o)
                print(e)
Esempio n. 3
0
  def __init__(self):
    # log start
    initTs = time.clock()
    self.startupTimeStamp = time.time()

    # parse startup arguments
    start = startup.Startup()
    args = start.args
    self.args = args
    self.originalCWD = originalCWD

    # restore the persistent options dictionary
    self.d = {}
    self.options = options.Options(self)
    # options value watching
    self.maxWatchId = 0
    self.watches = {}
    # history lock
    self.historyLock = RLock() # NOTE: not yet used

    # enable stats
    self.stats = stats.Stats(self)

    self.continuousReading = True

    # get the platform module
    self.platform = None

    # get the platform ID string
    platformId = "pc" # safe fallback
    if args.p is None:
      import platform_detection
      # platform detection
      result = platform_detection.getBestPlatformModuleId()
      if result:
        platformId = result
    else: # use the CLI provided value
      platformId = args.p

    if platformId:
      if platformId == "maemo5":
        import maemo5

        if args.u == "hildon": # enable app menu with Hildon gui
          self.platform = maemo5.Maemo5(self, GTK=True)
        else:
          self.platform = maemo5.Maemo5(self, GTK=False)
      elif platformId == "harmattan":
        import harmattan

        self.platform = harmattan.Harmattan(self)
      else:
        import pc

        self.platform = pc.PC(self)

    else:
      # no platform provided, decide based on selected GUI
      if args.u == "hildon":
        import maemo5

        self.platform = maemo5.Maemo5(self, GTK=True)
      elif args.u == "harmattan":
        import harmattan

        self.platform = harmattan.Harmattan(self)
      else:
        import pc

        self.platform = pc.PC(self)


    # create the GUI
    startTs1 = timer.start()

    # use CLI provided GUI module ID
    if args.u:
      self._loadGUIModule(args.u)
    else: # get GUI module id from the platform module
      ids = self.platform.getSupportedGUIModuleIds()
      if ids:
        guiModuleId = ids[0]
        print('preferred GUI ID from platform module: %s' % guiModuleId)
        self._loadGUIModule(guiModuleId)
      else:
        print("platform module error: list of supported GUI IDs is empty")

    timer.elapsed(startTs1, "GUI module import")

    #    # resize the viewport when window size changes
    #    self.gui.resizeNotify(self._resizeViewport)

    self.activeManga = None

    # check if a path was specified in the startup arguments
    if args.o is not None:
      try:
        print("loading manga from: %s" % args.o)
        self.setActiveManga(self.openManga(args.o, checkHistory=True))
        print('manga loaded')
      except Exception, e:
        print("loading manga from path: %s failed" % args.o)
        print(e)