]>
Softwares of Agnibho - ddstorm.git/blob - __main__.py
5 # Copyright (c) 2015 Agnibho Mondal
8 # This file is part of DDStorm.
10 # DDStorm is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
15 # DDStorm is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with DDStorm. If not, see <http://www.gnu.org/licenses/>.
23 import sys
, time
, subprocess
24 from PyQt4
import QtGui
, QtCore
25 from _symptoms
import Symptoms
26 from _differentials
import Differentials
27 from ddstorm
import DDStorm
34 class Content(QtGui
.QWidget
):
35 change
=QtCore
.pyqtSignal()
37 super(Content
, self
).__init
__()
38 self
.dd
=DDStorm(True,conf
)
39 if(not self
.dd
.compiler
.clean
):
40 ret
=QtGui
.QMessageBox
.warning(self
, "Compilation Error", "Error was encountered while compiling the Knowledgebase.", "Ignore", "View Log")
47 grid
=QtGui
.QGridLayout()
50 self
.symp
=Symptoms(self
.dd
.symptoms())
51 self
.symp
.setFrameShape(QtGui
.QFrame
.StyledPanel
)
52 self
.symp
.changed
.connect(self
.update
)
54 self
.diff
=Differentials()
55 self
.diff
.setFrameShape(QtGui
.QFrame
.StyledPanel
)
57 grid
.addWidget(self
.symp
, 0, 0)
58 grid
.addWidget(self
.diff
, 0, 1)
59 grid
.setColumnStretch(0, 1)
60 grid
.setColumnStretch(1, 1)
61 QtGui
.QApplication
.setStyle(QtGui
.QStyleFactory
.create("Cleanlooks"))
62 def update(self
, data
):
63 self
.diff
.update(self
.dd
.dd(data
))
66 class Window(QtGui
.QMainWindow
):
68 super(Window
, self
).__init
__()
73 self
.sett
=SettingsDialog(conf
)
74 if(conf
.get("status_message")=="on"):
75 self
.con
.change
.connect(self
.showStatus
)
78 menuFile
=menu
.addMenu("&File")
79 menuFile
.addAction("&Save").triggered
.connect(self
.savefile
)
80 menuFile
.addAction("E&xit").triggered
.connect(self
.close
)
81 menuEdit
=menu
.addMenu("&Edit")
82 menuEdit
.addAction("&Add").triggered
.connect(self
.con
.symp
.addItem
)
83 menuEdit
.addAction("&Browse Symptoms").triggered
.connect(self
.con
.symp
.browseSymptoms
)
84 rmAction
=QtGui
.QAction("&Remove", self
)
85 rmAction
.setShortcut("Delete")
86 rmAction
.triggered
.connect(self
.con
.symp
.remove
)
87 menuEdit
.addAction(rmAction
)
88 menuEdit
.addAction("&Clear All").triggered
.connect(self
.con
.symp
.removeAll
)
89 menuTool
=menu
.addMenu("&Tools")
90 menuTool
.addAction("&Library").triggered
.connect(x_lib
)
91 menuTool
.addAction("&Settings").triggered
.connect(self
.settings
)
92 menuTool
.addAction("&View Log").triggered
.connect(x_logfile
)
93 menuHelp
=menu
.addMenu("&Help")
94 menuHelp
.addAction("&Help").triggered
.connect(x_help
)
95 menuHelp
.addAction("&About").triggered
.connect(self
.about
)
97 self
.setCentralWidget(self
.con
)
98 self
.status
=self
.statusBar()
99 self
.setGeometry(200, 200, 600, 400)
100 self
.setWindowTitle("D/D Storm")
101 self
.setWindowIcon(QtGui
.QIcon("icons/icon.png"))
103 self
.con
.symp
.new
.setFocus()
104 def showStatus(self
):
105 if(self
.con
.symp
.getList() and self
.con
.diff
.getList()):
106 self
.status
.showMessage(str(len(self
.con
.diff
.getList()))+" differential diagnosis for "+str(len(self
.con
.symp
.getList()))+" symptom(s).")
108 self
.status
.showMessage("")
110 x_save(self
, self
.con
.symp
.getList(), self
.con
.diff
.getList())
114 QtGui
.QMessageBox
.about(self
, "About", "<h1>DDStorm</h1>\nBrainstorm Medicine")
117 app
=QtGui
.QApplication(sys
.argv
)
121 if(conf
.get("clean_log")=="yes"):
122 open(LOG_FILE
, "w").close()
123 if(conf
.get("splash_screen")=="yes"):
128 splash
=QtGui
.QSplashScreen(QtGui
.QPixmap("icons/splash.png"))
132 splash
.showMessage("Loading...")
138 sys
.exit(app
.exec_())
140 if(__name__
=="__main__"):