import subprocess
import os
-from PyQt4 import QtGui, QtCore
+from PyQt5 import QtWidgets, QtCore
from const import *
def x_settings():
def x_save(w, symp, diff):
''' Save data to a file '''
- fname=QtGui.QFileDialog.getSaveFileName(w, "Save File", "~", "HTML files('*.html')")
+ fname=QtWidgets.QFileDialog.getSaveFileName(w, "Save File", "~", "HTML files('*.html')")
if(not fname.endswith(".html")):
fname=fname+".html"
with open(fname, "w") as f:
subprocess.Popen(["xdg-open", LOG_FILE])
-class SettingsDialog(QtGui.QDialog):
+class SettingsDialog(QtWidgets.QDialog):
'''
Provides a dialog box to configure application settings with a
graphical user interface.
def initUI(self):
''' Initiate the user interface '''
- self.lpLabel=QtGui.QLabel("Libary Path:")
- self.lpEdit=QtGui.QLineEdit(self.conf.get("library_path"))
- self.lpBrowse=QtGui.QPushButton("Browse")
+ self.lpLabel=QtWidgets.QLabel("Libary Path:")
+ self.lpEdit=QtWidgets.QLineEdit(self.conf.get("library_path"))
+ self.lpBrowse=QtWidgets.QPushButton("Browse")
self.lpBrowse.clicked.connect(self.lpUpdate)
- self.cpLabel=QtGui.QLabel("Custom Path:")
- self.cpEdit=QtGui.QLineEdit(self.conf.get("custom_path"))
- self.cpBrowse=QtGui.QPushButton("Browse")
+ self.cpLabel=QtWidgets.QLabel("Custom Path:")
+ self.cpEdit=QtWidgets.QLineEdit(self.conf.get("custom_path"))
+ self.cpBrowse=QtWidgets.QPushButton("Browse")
self.cpBrowse.clicked.connect(self.cpUpdate)
- self.mpLabel=QtGui.QLabel("Module Path:")
- self.mpEdit=QtGui.QLineEdit(self.conf.get("module_path"))
- self.mpBrowse=QtGui.QPushButton("Browse")
+ self.mpLabel=QtWidgets.QLabel("Module Path:")
+ self.mpEdit=QtWidgets.QLineEdit(self.conf.get("module_path"))
+ self.mpBrowse=QtWidgets.QPushButton("Browse")
self.mpBrowse.clicked.connect(self.mpUpdate)
- self.splash=QtGui.QCheckBox("Show Splash Screen")
+ self.splash=QtWidgets.QCheckBox("Show Splash Screen")
if(self.conf.get("splash_screen")=="yes"):
self.splash.setChecked(True)
- self.clean=QtGui.QCheckBox("Clean Log on Exit")
+ self.clean=QtWidgets.QCheckBox("Clean Log on Exit")
if(self.conf.get("clean_log")=="yes"):
self.clean.setChecked(True)
- self.status=QtGui.QCheckBox("Show Status Message")
+ self.status=QtWidgets.QCheckBox("Show Status Message")
if(self.conf.get("status_message")=="on"):
self.status.setChecked(True)
- self.ok=QtGui.QPushButton("Ok")
+ self.ok=QtWidgets.QPushButton("Ok")
self.ok.clicked.connect(self.save)
- self.cancel=QtGui.QPushButton("Cancel")
+ self.cancel=QtWidgets.QPushButton("Cancel")
self.cancel.clicked.connect(self.close)
- self.default=QtGui.QPushButton("Default")
+ self.default=QtWidgets.QPushButton("Default")
self.default.clicked.connect(self.reset)
- ctrl=QtGui.QHBoxLayout()
+ ctrl=QtWidgets.QHBoxLayout()
ctrl.addWidget(self.ok)
ctrl.addWidget(self.cancel)
ctrl.addWidget(self.default)
- layout=QtGui.QGridLayout(self)
+ layout=QtWidgets.QGridLayout(self)
layout.addWidget(self.lpLabel, 0, 0)
layout.addWidget(self.lpEdit, 0, 1)
layout.addWidget(self.lpBrowse, 0, 2)
def getFolder(self):
''' Returns the selected directory '''
- dn=QtGui.QFileDialog.getExistingDirectory()
+ dn=QtWidgets.QFileDialog.getExistingDirectory()
if(dn.startswith(QtCore.QDir.currentPath())):
dn="."+dn[len(QtCore.QDir.currentPath()):]+"/"
else:
self.conf.set("status_message", "on")
else:
self.conf.set("status_message", "off")
- QtGui.QMessageBox.information(self, "Restart required", "Some settings takes effect only after restarting DDStorm")
+ QtWidgets.QMessageBox.information(self, "Restart required", "Some settings takes effect only after restarting DDStorm")
self.close()
self.conf.write()
import time
import subprocess
-from PyQt4 import QtGui, QtCore
+from PyQt5 import QtWidgets, QtGui, QtCore
from panes import Symptoms, Differentials
from ddstorm import DDStorm
conf=False
-class Content(QtGui.QWidget):
+class Content(QtWidgets.QWidget):
'''
Provides the main content widget. Contains the sysmptoms and
the diagnosis panes. Also creates the DDStorm object and performs
# Show warning if any error happened during data compilation
if(not self.dd.compiler.is_clean()):
- ret=QtGui.QMessageBox.warning(self, "Compilation Error", "Error was encountered while compiling the Knowledgebase.", "Ignore", "View Log")
+ ret=QtWidgets.QMessageBox.warning(self, "Compilation Error", "Error was encountered while compiling the Knowledgebase.", "Ignore", "View Log")
if(ret==1):
x_logfile()
global conf
- grid=QtGui.QGridLayout()
+ grid=QtWidgets.QGridLayout()
self.setLayout(grid)
self.symp=Symptoms(self.dd.symptoms())
- self.symp.setFrameShape(QtGui.QFrame.StyledPanel)
+ self.symp.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.symp.changed.connect(self.update)
self.diff=Differentials()
- self.diff.setFrameShape(QtGui.QFrame.StyledPanel)
+ self.diff.setFrameShape(QtWidgets.QFrame.StyledPanel)
grid.addWidget(self.symp, 0, 0)
grid.addWidget(self.diff, 0, 1)
grid.setColumnStretch(0, 1)
grid.setColumnStretch(1, 1)
- QtGui.QApplication.setStyle(QtGui.QStyleFactory.create("Cleanlooks"))
+ QtWidgets.QApplication.setStyle(QtWidgets.QStyleFactory.create("Cleanlooks"))
def update(self, data):
''' Update the inteface with refreshed information '''
self.change.emit()
-class Window(QtGui.QMainWindow):
+class Window(QtWidgets.QMainWindow):
'''
Provides main application window. Acts as a container for the
content widget. Also contains the menubar and the status bar.
menuEdit=menu.addMenu("&Edit")
menuEdit.addAction("&Add").triggered.connect(self.con.symp.addItem)
menuEdit.addAction("&Browse Symptoms").triggered.connect(self.con.symp.browseSymptoms)
- rmAction=QtGui.QAction("&Remove", self)
+ rmAction=QtWidgets.QAction("&Remove", self)
rmAction.setShortcut("Delete")
rmAction.triggered.connect(self.con.symp.remove)
menuEdit.addAction(rmAction)
def about(self):
''' Show information about this application '''
- QtGui.QMessageBox.about(self, "About", "<h1>DDStorm</h1>\nBrainstorm Medicine")
+ QtWidgets.QMessageBox.about(self, "About", "<h1>DDStorm</h1>\nBrainstorm Medicine")
def main():
''' Start the main application interface '''
- app=QtGui.QApplication(sys.argv)
+ app=QtWidgets.QApplication(sys.argv)
# Initiate the global configuration
global conf
else:
ss=False
if(ss):
- splash=QtGui.QSplashScreen(QtGui.QPixmap("icons/splash.png"))
+ splash=QtWidgets.QSplashScreen(QtWidgets.QPixmap("icons/splash.png"))
splash.show()
time.sleep(0.1)
app.processEvents()
along with DDStorm. If not, see <http://www.gnu.org/licenses/>.
'''
-from PyQt4 import QtGui, QtCore
+from PyQt5 import QtWidgets, QtCore
-class Symptoms(QtGui.QFrame):
+class Symptoms(QtWidgets.QFrame):
''' Provides the widget for symptoms input '''
# List to hold the symptoms
def initUI(self):
''' Initiate the user interface '''
- self.label=QtGui.QLabel("Symptoms")
+ self.label=QtWidgets.QLabel("Symptoms")
self.label.setStyleSheet("font-size:18px")
- self.listWidget=QtGui.QListWidget(self)
+ self.listWidget=QtWidgets.QListWidget(self)
self.listWidget.setStyleSheet("font-size:14px")
self.listWidget.setSelectionMode(4)
- self.rm=QtGui.QPushButton("Remove")
+ self.rm=QtWidgets.QPushButton("Remove")
self.rm.clicked.connect(self.remove)
- self.cl=QtGui.QPushButton("Clear All")
+ self.cl=QtWidgets.QPushButton("Clear All")
self.cl.clicked.connect(self.removeAll)
- self.browse=QtGui.QPushButton("Browse Symptoms")
+ self.browse=QtWidgets.QPushButton("Browse Symptoms")
self.browse.clicked.connect(self.browseSymptoms)
- self.add=QtGui.QPushButton("Add")
+ self.add=QtWidgets.QPushButton("Add")
self.add.clicked.connect(self.addItem)
- self.new=QtGui.QLineEdit(self)
+ self.new=QtWidgets.QLineEdit(self)
self.new.returnPressed.connect(self.addItem)
- self.completer=QtGui.QCompleter(self.auto)
+ self.completer=QtWidgets.QCompleter(self.auto)
self.completer.setCaseSensitivity(0)
self.completer.setCompletionMode(2)
self.new.setCompleter(self.completer)
self.browser=SymptomBrowser(self.auto)
self.browser.added.connect(self.addItem)
- hboxt=QtGui.QHBoxLayout()
+ hboxt=QtWidgets.QHBoxLayout()
hboxt.addWidget(self.new)
hboxt.addWidget(self.add)
- hboxb=QtGui.QHBoxLayout()
+ hboxb=QtWidgets.QHBoxLayout()
hboxb.addWidget(self.rm)
hboxb.addWidget(self.cl)
hboxb.addWidget(self.browse)
- vbox=QtGui.QVBoxLayout()
+ vbox=QtWidgets.QVBoxLayout()
vbox.addWidget(self.label)
vbox.addLayout(hboxt)
vbox.addWidget(self.listWidget)
text=self.new.text()
if(len(text)>0):
if(text in self.sympList):
- QtGui.QMessageBox.information(self, "Duplicate Symptom", "'"+text+"' has already been added to the symptom list.")
+ QtWidgets.QMessageBox.information(self, "Duplicate Symptom", "'"+text+"' has already been added to the symptom list.")
elif(text in self.auto):
- QtGui.QListWidgetItem(text, self.listWidget)
+ QtWidgets.QListWidgetItem(text, self.listWidget)
self.sympList.append(text)
self.new.clear()
self.changed.emit(list(self.sympList))
else:
- QtGui.QMessageBox.warning(self, "Symptom Unvailable", "'"+text+"' is not available in the current Library.")
+ QtWidgets.QMessageBox.warning(self, "Symptom Unvailable", "'"+text+"' is not available in the current Library.")
def remove(self, all=False):
''' Remove selected symptoms '''
return self.sympList
-class SymptomBrowser(QtGui.QDialog):
+class SymptomBrowser(QtWidgets.QDialog):
'''
Provides a dialog with a list of symptoms for alternative user
input.
def initUI(self):
''' Initiate the dialog interface '''
- self.search=QtGui.QLineEdit()
+ self.search=QtWidgets.QLineEdit()
self.search.textChanged.connect(self.refresh)
- self.listItems=QtGui.QListWidget()
+ self.listItems=QtWidgets.QListWidget()
self.listItems.activated.connect(self.sendUp)
- layout=QtGui.QVBoxLayout(self)
+ layout=QtWidgets.QVBoxLayout(self)
layout.addWidget(self.search)
layout.addWidget(self.listItems)
self.close()
-class Differentials(QtGui.QFrame):
+class Differentials(QtWidgets.QFrame):
''' Provides the widget for differential diagnosis output '''
data=[]
def initUI(self):
''' Initiate the user interface '''
- self.label=QtGui.QLabel("Differential Diagnosis")
+ self.label=QtWidgets.QLabel("Differential Diagnosis")
self.label.setStyleSheet("font-size:18px")
- self.listWidget=QtGui.QListWidget(self)
+ self.listWidget=QtWidgets.QListWidget(self)
self.listWidget.setStyleSheet("font-size:14px")
self.listWidget.setSelectionMode(0)
- box=QtGui.QVBoxLayout()
+ box=QtWidgets.QVBoxLayout()
box.addWidget(self.label)
box.addWidget(self.listWidget)
self.setLayout(box)
self.listWidget.clear()
if(self.data):
for d in self.data:
- QtGui.QListWidgetItem(d, self.listWidget)
+ QtWidgets.QListWidgetItem(d, self.listWidget)
def getList(self):
''' Return a list of current differential diagnosis '''