-
Notifications
You must be signed in to change notification settings - Fork 1
/
ProgConfigDlg.py
68 lines (59 loc) · 2.12 KB
/
ProgConfigDlg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import QDialog
import ui_progconfigdlg
import sys
class ProgConfigDlg(QDialog, ui_progconfigdlg.Ui_ProgConfigDlg):
def __init__(self, configcode=0, parent=None):
super(ProgConfigDlg, self).__init__(parent)
self.setupUi(self)
self.configcode = configcode
self.uiarray = [self.alignCheckBox, self.consensusCheckBox,
self.unmapCheckBox, self.hybridCheckBox]
if (configcode > 0):
self.runallRadioButton.setEnabled(False)
self.runselectedRadioButton.setChecked(True)
self.__run_selected()
else:
self.runallRadioButton.setChecked(True)
self.__run_all()
self.setFixedSize(415, 290)
def __run_all(self):
for i in range(4):
self.uiarray[i].setEnabled(False)
def __run_selected(self):
self.alignCheckBox.setEnabled(False)
self.alignCheckBox.setChecked(True)
for i in range(1,4):
mask = 1 << i
if(self.configcode & mask):
self.uiarray[i].setEnabled(False)
self.uiarray[i].setChecked(True)
else:
self.uiarray[i].setEnabled(True)
def on_runselectedRadioButton_clicked(self):
self.__run_selected()
def on_runallRadioButton_clicked(self):
self.__run_all()
@pyqtSlot()
def on_okayButton_clicked(self):
if(self.runallRadioButton.isChecked()):
self.retcode = int('1111',2)
else:
retcode = 0
for i in range(len(self.uiarray)):
if(self.uiarray[i].isChecked()):
retcode = retcode | 1 << i
if(retcode < 1):
QMessageBox.warning(self, "Error",("You haven't select any program yet!"))
return
else:
self.retcode = retcode
self.accept()
def main():
app = QApplication(sys.argv)
mainwindow = ProgConfigDlg(int('0011',2))
mainwindow.show()
app.exec_()
if(__name__ == '__main__'):
main()