コード例 #1
0
ファイル: MainWindow.py プロジェクト: BeTeK/EliteMerchant
    def _readSettings(self):

        versionstring = "?"
        try:
            with open("version.txt", "r") as f:
                versionstring = f.readline()
        except IOError:
            print("could not read version file")

        self.setWindowTitle("Elite Merchant   v" + versionstring)
        Options.set("Merchant-version", versionstring)

        self.restoreGeometry(
            Options.get("MainWindow-geometry", QtCore.QByteArray()))
        self.restoreState(Options.get("MainWindow-state", QtCore.QByteArray()))

        self.cargoSizeSpinBox.setValue(
            int(Options.get("ship_cargo_size", "100")))
        self.jumpRangeSpinBox.setValue(
            float(Options.get("ship_jump_range", "16")))
        self.minPadSizeCombo.setCurrentIndex(
            int(Options.get("ship_landing_pad_size", "0")))

        tabCount = int(Options.get("main_window_tab_count", "0"))

        for index in range(tabCount):
            type = Options.get("main_window_tab_{0}_type".format(index), "")

            if type == "search":
                item = ("Search {0}".format(index + 1),
                        ui.SearchTab.SearchTab(self.db, self.analyzer,
                                               str(index + 1), self))
            elif type == "status":
                item = ("Status {0}".format(index + 1),
                        ui.Status.Status(self.db, self.analyzer,
                                         str(index + 1), self))
            elif type == "guide":
                item = ("User Guide",
                        ui.GuideTab.GuideTab(self.db, self.analyzer, "", self))
            elif type == "commodity":
                item = ("Commodities {0}".format(index + 1),
                        ui.CommodityTab.CommodityTab(self.db, self.analyzer,
                                                     str(index + 1), self))

            self.tabItems.append(item)
        if len(self.tabItems) == 0:
            self._addGuideTabSelected()
コード例 #2
0
ファイル: MainWindow.py プロジェクト: BeTeK/EliteMerchant
  def _readSettings(self):

    versionstring="?"
    try:
      with open("version.txt", "r") as f:
          versionstring = f.readline()
    except IOError:
      print("could not read version file")

    self.setWindowTitle("Elite Merchant   v"+versionstring)
    Options.set("Merchant-version",versionstring)

    self.restoreGeometry(Options.get("MainWindow-geometry", QtCore.QByteArray()))
    self.restoreState(Options.get("MainWindow-state", QtCore.QByteArray()))

    self.cargoSizeSpinBox.setValue(int(Options.get("ship_cargo_size", "100")))
    self.jumpRangeSpinBox.setValue(float(Options.get("ship_jump_range", "16")))
    self.minPadSizeCombo.setCurrentIndex(int(Options.get("ship_landing_pad_size", "0")))

    tabCount = int(Options.get("main_window_tab_count", "0"))

    for index in range(tabCount):
      type = Options.get("main_window_tab_{0}_type".format(index), "")

      if type == "search":
        item = ("Search {0}".format(index + 1), ui.SearchTab.SearchTab(self.db, self.analyzer, str(index + 1),self))
      elif type == "status":
        item = ("Status {0}".format(index + 1), ui.Status.Status(self.db, self.analyzer, str(index + 1),self))
      elif type == "guide":
        item = ("User Guide", ui.GuideTab.GuideTab(self.db, self.analyzer, "", self))
      elif type == "commodity":
        item = ("Commodities {0}".format(index + 1), ui.CommodityTab.CommodityTab(self.db, self.analyzer, str(index + 1),self))

      self.tabItems.append(item)
    if len(self.tabItems)==0:
      self._addGuideTabSelected()
コード例 #3
0
ファイル: MainWindow.py プロジェクト: BeTeK/EliteMerchant
    def closeEvent(self, event):
        self.sounds.quit()  # unload soundsystem

        for tab in self.tabItems:  # shut down any searches in progress
            if tab[1].getType() == "search":
                tab[1].cancelSearch()

        index = 0
        for name, widget in self.tabItems:
            if widget.getType() == 'update':  # don't save updatewindows
                continue
            Options.set("main_window_tab_{0}_type".format(index),
                        widget.getType())
            widget.dispose()
            index += 1

        Options.set("main_window_tab_count", index)

        Options.set("ship_cargo_size", self.cargoSizeSpinBox.value())
        Options.set("ship_jump_range", self.jumpRangeSpinBox.value())
        Options.set("ship_landing_pad_size",
                    self.minPadSizeCombo.currentIndex())

        Options.set("MainWindow-geometry", self.saveGeometry())
        Options.set("MainWindow-state", self.saveState())
        print("Waiting for EDCE fetch to complete")
        self.timer.stop()
        if self.edce is not None:
            self.edce.join()
コード例 #4
0
ファイル: MainWindow.py プロジェクト: BeTeK/EliteMerchant
  def closeEvent(self, event):
    self.sounds.quit() # unload soundsystem

    for tab in self.tabItems: # shut down any searches in progress
      if tab[1].getType() == "search":
        tab[1].cancelSearch()

    index = 0
    for name, widget in self.tabItems:
      if widget.getType()=='update': # don't save updatewindows
        continue
      Options.set("main_window_tab_{0}_type".format(index), widget.getType())
      widget.dispose()
      index += 1

    Options.set("main_window_tab_count", index)

    Options.set("ship_cargo_size", self.cargoSizeSpinBox.value())
    Options.set("ship_jump_range", self.jumpRangeSpinBox.value())
    Options.set("ship_landing_pad_size", self.minPadSizeCombo.currentIndex())

    Options.set("MainWindow-geometry", self.saveGeometry())
    Options.set("MainWindow-state", self.saveState())
    print("Waiting for EDCE fetch to complete")
    self.timer.stop()
    if self.edce is not None:
      self.edce.join()