Skip to content

Commit

Permalink
Merge pull request #119 from ytkz11/ytkz
Browse files Browse the repository at this point in the history
gui-multithreading
  • Loading branch information
zhoubin-me authored Nov 5, 2021
2 parents e4258a0 + 8c7b560 commit 7ee5f43
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions config/default.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
auto_restart: false
bn_path: C:/Program Files (x86)/Battle.net/Battle.net.exe
bn_path: F:\battle\Battle.net/Battle.net.exe
boss_id: 5
confidence: 0.8
delay: 0.5
Expand Down Expand Up @@ -35,7 +35,7 @@ hero:
- Diablo
- 3, 2, 1
- 3
hs_path: E:/Games/Hearthstone/Hearthstone.exe
hs_path: F:\battle\copy\Hearthstone/Hearthstone.exe
lang: ZH-1600x900
longest_waiting: 80
reward_count: 5
Expand Down
19 changes: 15 additions & 4 deletions main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pinyin
import yaml
from PyQt5 import uic, QtCore, QtWidgets
from PyQt5.QtCore import QStringListModel
from PyQt5.QtCore import QStringListModel, QThread, pyqtSignal
from PyQt5.QtWidgets import *

from utils.util import HEROS
Expand All @@ -22,7 +22,17 @@
if hasattr(QtCore.Qt, 'AA_UseHighDpiPixmaps'):
PyQt5.QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)


class Thread_2(QThread):
_signal =pyqtSignal()
def __init__(self,config):
super().__init__()
self.config = config
def run(self):

from lushi import run_from_gui
run_from_gui(self.config)
self._signal.emit()

class Ui(QMainWindow):
def __init__(self):
super(Ui, self).__init__()
Expand Down Expand Up @@ -327,9 +337,10 @@ def runButtonPressed(self):

reply = QMessageBox.question(self, 'CONFIRM', cfm_text, QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
if reply == QMessageBox.Yes:
from lushi import run_from_gui

self.save_config()
run_from_gui(self.config)
self.thread_2 =Thread_2(self.config)
self.thread_2.start()
else:
pass

Expand Down

0 comments on commit 7ee5f43

Please sign in to comment.