示例#1
0
def main():
    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon(utils.find_data_file("icon.png")))
    window = MainWindow()
    window.showMaximized()
    window.hint_window.show()
    app.exec()
        def __init__(self):
            self.country_cache_path = utils.find_data_file('country_cache.p')
            self.city_cache_path = utils.find_data_file('city_cache.p')

            try:
                with open(self.country_cache_path, 'rb') as f:
                    self.country_cache = pickle.load(f)
            except:
                print('Could not load country cache')
                self.country_cache = {}

            try:
                with open(self.city_cache_path, 'rb') as f:
                    self.city_cache = pickle.load(f)
            except:
                print('Could not load city cache')
                self.city_cache = {}
    def __init__(self, name, parent=None):
        super().__init__(parent)
        self.name = name
        self.model = TreeModel(utils.find_data_file("%s_num2name.p" % name),
                               "", self)
        self.setSelectionMode(QAbstractItemView.NoSelection)
        with open(utils.find_data_file("%s_num2name.p" % name), "rb") as f:
            self.num2name = pickle.load(f)
        with open(utils.find_data_file("%s_name2num.p" % name), "rb") as f:
            self.name2num = pickle.load(f)

        self.setModel(self.model)

        self.font = QFont()
        self.font.setPixelSize(9)
        self.setFont(self.font)
        self.unselect_all()

        self.doubleClicked.connect(self.selected_slot)
def main():
    import sys
    app = QApplication(sys.argv)

    v = QTreeView()
    model = TreeModel(utils.find_data_file('disease_num2name.p'), 'Disease')
    v.setModel(model)
    v.selectionModel().select(
        QItemSelection(model.index(0, 0), model.index(5, 0)),
        QItemSelectionModel.Select)
    v.setSelectionMode(QAbstractItemView.NoSelection)
    v.setEditTriggers(QAbstractItemView.NoEditTriggers)
    v.show()
    app.exec()
 def show_about_dialog(self):
     about_text = QFile(utils.find_data_file("about_text.html"))
     about_text.open(QIODevice.ReadOnly)
     text = str(about_text.readAll(), 'utf-8')
     # noinspection PyCallByClass
     QMessageBox.about(self.centralWidget(), 'About', text)
示例#6
0
 def __init__(self, parent=None):
     super().__init__(parent)
     self._conn = None
     self.query_thread = None
     with open(utils.find_data_file("disease_num2name.p"), "rb") as f:
         self.disease_dictionary = pickle.load(f)