1+ """
2+ Provide simple plotting functionality for PhysiCell output results.
3+
4+ Authors:
5+ Randy Heiland (heiland@iu.edu)
6+ Dr. Paul Macklin (macklinp@iu.edu)
7+
8+ --- Versions ---
9+ 0.1 - initial version
10+ """
11+ # https://doc.qt.io/qtforpython/gettingstarted.html
12+
13+ import os
14+ import sys
15+ import getopt
16+ import shutil
17+ from pathlib import Path
18+ import xml .etree .ElementTree as ET # https://docs.python.org/2/library/xml.etree.elementtree.html
19+ from xml .dom import minidom
20+
21+ from PyQt5 import QtCore , QtGui
22+ from PyQt5 .QtWidgets import *
23+
24+ from vis_tab_ellipse import Vis
25+
26+ def SingleBrowse (self ):
27+ # if len(self.csv) < 2:
28+ filePath = QFileDialog .getOpenFileName (self ,'' ,"." ,'*.xml' )
29+
30+ # if filePath != "" and not filePath in self.csv:
31+ # self.csv.append(filePath)
32+ # print(self.csv)
33+
34+ class PhysiCellXMLCreator (QWidget ):
35+ # def __init__(self, parent = None):
36+ def __init__ (self , parent = None ):
37+ super (PhysiCellXMLCreator , self ).__init__ (parent )
38+
39+ self .title_prefix = "PhysiCell Visualization"
40+ self .setWindowTitle (self .title_prefix )
41+
42+ # Menus
43+ vlayout = QVBoxLayout (self )
44+ # vlayout.setContentsMargins(5, 35, 5, 5)
45+ # menuWidget = QWidget(self.menu())
46+ # vlayout.addWidget(menuWidget)
47+
48+ # self.setWindowIcon(self.style().standardIcon(getattr(QStyle, 'SP_DialogNoButton')))
49+ # self.setWindowIcon(QtGui.QIcon('physicell_logo_25pct.png'))
50+ # self.grid = QGridLayout()
51+ # lay.addLayout(self.grid)
52+ self .setLayout (vlayout )
53+ # self.setMinimumSize(400, 790) # width, height (height >= Cell Types|Death params)
54+ # self.setMinimumSize(400, 500) # width, height (height >= Cell Types|Death params)
55+ # self.setMinimumSize(800, 620) # width, height (height >= Cell Types|Death params)
56+ # self.setMinimumSize(800, 660) # width, height (height >= Cell Types|Death params)
57+ # self.setMinimumSize(800, 800) # width, height (height >= Cell Types|Death params)
58+ # self.setMinimumSize(700, 770) # width, height (height >= Cell Types|Death params)
59+ self .setMinimumSize (800 , 770 ) # width, height (height >= Cell Types|Death params)
60+ # self.setMinimumSize(600, 600) # width, height (height >= Cell Types|Death params)
61+ # self.resize(400, 790) # width, height (height >= Cell Types|Death params)
62+
63+ # self.menubar = QtWidgets.QMenuBar(self)
64+ # self.file_menu = QtWidgets.QMenu('File')
65+ # self.file_menu.insertAction("Open")
66+ # self.menubar.addMenu(self.file_menu)
67+
68+ # GUI tabs
69+
70+ # By default, let's startup the app with a default of template2D (a copy)
71+ # self.new_model_cb() # default on startup
72+ # read_file = "../data/subcellular_flat.xml"
73+ # read_file = "../data/cancer_biorobots_flat.xml"
74+ # read_file = "../data/pred_prey_flat.xml"
75+
76+ model_name = "pred_prey_flat"
77+ model_name = "biorobots_flat"
78+ model_name = "cancer_biorobots_flat"
79+ model_name = "test1"
80+ model_name = "test-gui"
81+ model_name = "covid19_v5_flat"
82+ model_name = "template"
83+ # model_name = "randy_test" #rwh
84+ # read_file = "data/" + model_name + ".xml"
85+
86+ # then what??
87+ # binDirectory = os.path.realpath(os.path.abspath(__file__))
88+ binDirectory = os .path .dirname (os .path .abspath (__file__ ))
89+ dataDirectory = os .path .join (binDirectory ,'..' ,'data' )
90+
91+ # self.tree = ET.parse(self.config_file)
92+ # self.xml_root = self.tree.getroot()
93+
94+
95+ #------------------
96+ tabWidget = QTabWidget ()
97+ self .vis_tab = Vis ()
98+ # self.vis_tab.xml_root = self.xml_root
99+ tabWidget .addTab (self .vis_tab ,"" )
100+
101+ vlayout .addWidget (tabWidget )
102+ # self.addTab(self.sbml_tab,"SBML")
103+
104+ tabWidget .setCurrentIndex (0 ) # Config (default)
105+
106+
107+ def menu (self ):
108+ menubar = QMenuBar (self )
109+ menubar .setNativeMenuBar (False )
110+
111+ #--------------
112+ file_menu = menubar .addMenu ('&File' )
113+
114+ # # file_menu.addAction("Open", self.open_as_cb, QtGui.QKeySequence('Ctrl+o'))
115+ # file_menu.addAction("Save", self.save_cb, QtGui.QKeySequence('Ctrl+s'))
116+
117+ menubar .adjustSize () # Argh. Otherwise, only 1st menu appears, with ">>" to others!
118+
119+ def main ():
120+ inputfile = ''
121+
122+ app = QApplication (sys .argv )
123+ ex = PhysiCellXMLCreator ()
124+ # ex.setGeometry(100,100, 800,600)
125+ ex .show ()
126+ sys .exit (app .exec_ ())
127+
128+ if __name__ == '__main__' :
129+ main ()
0 commit comments