@@ -23,7 +23,7 @@ def addListElement(self):
2323
2424 # text, ok = QInputDialog.getText(self, 'Enter Name',
2525 # 'Enter the desired name for your object:')
26- itemselect = uic .loadUi ("uis\\ SelectionDialog.ui" )
26+ itemselect = uic .loadUi ("uis" + savestate . symbol + " SelectionDialog.ui" )
2727 itemselect .setWindowTitle ("Itemselection" )
2828 itemselect .buttonBox .accepted .connect (itemselect .accept )
2929 itemselect .buttonBox .rejected .connect (itemselect .reject )
@@ -51,7 +51,7 @@ def addListElement(self):
5151 elif item == 3 :
5252 # Creates a CHRONOS item which writes time or dates to textfiles
5353 if ok :
54- information ( "Not implemented yet!" )
54+ createChronoItem ( self , text , "" , 3 )
5555 # savestate.itemorder.append(savestate.itemType.CHRONOS) TODO
5656
5757
@@ -65,7 +65,7 @@ def createTextItem(self, text, value, slist):
6565 print ("Added item: " + str (item ))
6666 logWrite ("Added item: " + str (item [savestate .count ]) + "\n " )
6767
68- wid = uic .loadUi ("uis\\ TextFileWidget.ui" )
68+ wid = uic .loadUi ("uis" + savestate . symbol + " TextFileWidget.ui" )
6969 wid .setStyleSheet (savestate .shortBorder )
7070 wid .label .setText (text )
7171
@@ -83,7 +83,7 @@ def createTextItem(self, text, value, slist):
8383 savestate .count = leftOne .count ()
8484 item = {savestate .count : str (text )}
8585 print ("Added item: " + str (item ))
86- wid = uic .loadUi ("uis\\ TextFileWidget.ui" )
86+ wid = uic .loadUi ("uis" + savestate . symbol + " TextFileWidget.ui" )
8787 wid .setStyleSheet (savestate .shortBorder )
8888 wid .label .setText (text )
8989 if value :
@@ -108,7 +108,7 @@ def createNumberItem(self: QMainWindow, text: str, value: int, listnr: int, pret
108108 savestate .count = leftOne .count ()
109109 item = {savestate .count : str (text )}
110110 print ("Added item: " + str (item ))
111- wid = uic .loadUi ("uis\\ NumberWidget.ui" )
111+ wid = uic .loadUi ("uis" + savestate . symbol + " NumberWidget.ui" )
112112 wid .setStyleSheet (savestate .shortBorder )
113113 wid .label .setText (text )
114114
@@ -130,7 +130,7 @@ def createNumberItem(self: QMainWindow, text: str, value: int, listnr: int, pret
130130 item = {savestate .count : str (text )}
131131 print ("Added item: " + str (item ))
132132
133- wid = uic .loadUi ("uis\\ NumberWidget.ui" )
133+ wid = uic .loadUi ("uis" + savestate . symbol + " NumberWidget.ui" )
134134 wid .setStyleSheet (savestate .shortBorder )
135135 wid .label .setText (text )
136136
@@ -150,6 +150,52 @@ def createNumberItem(self: QMainWindow, text: str, value: int, listnr: int, pret
150150 information ("Please select a list to add the object!" )
151151
152152
153+ def createChronoItem (self , text , value , listnr ):
154+ leftOne = self .ui .listWidget
155+ rightOne = self .ui .listWidget_2
156+
157+ if listnr == 0 or self .ui .addleft .isChecked ():
158+ savestate .count = leftOne .count ()
159+ item = {savestate .count : str (text )}
160+ print ("Added item: " + str (item ))
161+ wid = uic .loadUi ("uis" + savestate .symbol + "ChronoWidget.ui" )
162+ wid .setStyleSheet (savestate .shortBorder )
163+ wid .label .setText (text )
164+
165+ wid .showTime .setText (value )
166+
167+ wid .setWhatsThis ("chrono" )
168+ item [savestate .count ] = QListWidgetItem ()
169+ item [savestate .count ].setFlags (item [savestate .count ].flags () | Qt .ItemIsEditable )
170+ item [savestate .count ].setData (5 , text )
171+ item [savestate .count ].setSizeHint (QSize (270 , 80 ))
172+ leftOne .addItem (item [savestate .count ])
173+ leftOne .setItemWidget (item [savestate .count ], wid )
174+
175+ elif listnr == 1 or self .ui .addright .isChecked ():
176+
177+ savestate .count = rightOne .count ()
178+ item = {savestate .count : str (text )}
179+ print ("Added item: " + str (item ))
180+
181+ wid = uic .loadUi ("uis" + savestate .symbol + "ChronoWidget.ui" )
182+ wid .setStyleSheet (savestate .shortBorder )
183+ wid .label .setText (text )
184+
185+ wid .showTime .setText (value )
186+
187+ wid .setWhatsThis ("chrono" )
188+ item [savestate .count ] = QListWidgetItem ()
189+ item [savestate .count ].setFlags (item [savestate .count ].flags () | Qt .ItemIsEditable )
190+ item [savestate .count ].setData (5 , savestate .count + 1 )
191+ item [savestate .count ].setSizeHint (QSize (270 , 80 ))
192+ rightOne .addItem (item [savestate .count ])
193+ rightOne .setItemWidget (item [savestate .count ], wid )
194+
195+ else :
196+ information ("Please select a list to add the object!" )
197+
198+
153199def autTextListElement (self , name , nr , value , * itemType ):
154200 """
155201
@@ -177,7 +223,7 @@ def autTextListElement(self, name, nr, value, *itemType):
177223 print ("Added item: " + str (dictname .get (savestate .count )) + "\n " )
178224
179225 # create the widget and set the text
180- wid = uic .loadUi ("uis\\ TextFileWidget.ui" )
226+ wid = uic .loadUi ("uis" + savestate . symbol + " TextFileWidget.ui" )
181227 wid .setStyleSheet (savestate .shortBorder )
182228 wid .label .setText (text )
183229
@@ -197,7 +243,7 @@ def autTextListElement(self, name, nr, value, *itemType):
197243 savestate .count = leftOne .count ()
198244 dictname = {savestate .count : str (text )}
199245 print ("Added item: " + str (dictname .get (savestate .count )) + "\n " )
200- wid = uic .loadUi ("uis\\ TextFileWidget.ui" )
246+ wid = uic .loadUi ("uis" + savestate . symbol + " TextFileWidget.ui" )
201247 wid .setStyleSheet (savestate .shortBorder )
202248 wid .label .setText (text )
203249 wid .lineEdit .setText (value )
@@ -218,7 +264,7 @@ def getTextOfItem(self, path, altpath, *item):
218264 # that item in the form: "text" #unique "label" so it can be split. item should be a number
219265
220266 # init the xml file for the textfiles
221- xmlFile = open (path + " \\ autosave.xml" , "w+" )
267+ xmlFile = open (path + savestate . symbol + " autosave.xml" , "w+" )
222268
223269 # Introducing the xml data tree
224270 data = ET .Element ('data' )
@@ -364,14 +410,14 @@ def createListFiles(self, newpath):
364410 logWrite ("Trying to recall what was in the list..." )
365411
366412 # delete old textfiles and create a new empty folder
367- emptyDir (newpath + " \\ textfiles" )
368- os .mkdir (newpath + " \\ textfiles" )
413+ emptyDir (newpath + savestate . symbol + " textfiles" )
414+ os .mkdir (newpath + savestate . symbol + " textfiles" )
369415 logWrite ("Deleted old textfiles and created a fresh folder!\n " )
370416
371417 # Lets look in the xml so we know what was up
372418 try :
373419 print (savestate .standardFilePath )
374- source = ET .parse (savestate .standardFilePath + " \\ autosave.xml" )
420+ source = ET .parse (savestate .standardFilePath + savestate . symbol + " autosave.xml" )
375421 sourceroot = source .getroot ()
376422 logWrite ("Parsing autosave..." )
377423
@@ -423,7 +469,7 @@ def createListFiles(self, newpath):
423469
424470def createTextFile (name , path , text ):
425471 # This method is used to create and edit the textfiles used around the program.
426- filename = str (path + " \\ textfiles\\ " + name + ".txt" )
472+ filename = str (path + savestate . symbol + " textfiles" + savestate . symbol + name + ".txt" )
427473
428474 file = open (filename , "w+" )
429475 file .write (text )
@@ -432,7 +478,7 @@ def createTextFile(name, path, text):
432478
433479
434480def deleteTextFile (name , path ):
435- filename = str (path + " \\ textfiles\\ " + name + ".txt" )
481+ filename = str (path + savestate . symbol + " textfiles" + savestate . symbol + name + ".txt" )
436482 os .remove (filename )
437483
438484
@@ -443,6 +489,7 @@ def emptyDir(path):
443489
444490 logWrite ("The folder could not be found!" )
445491
492+
446493'''
447494 def autListElement(self, name, nr, value, itemType):
448495 if itemType == "text":
@@ -458,7 +505,7 @@ def saveConfig(self, basefilepath):
458505 # saves the current lists to a separate file
459506 filepath = QFileDialog .getSaveFileName (self , "Create Save" , basefilepath , ".oi" )
460507 file = str (filepath [0 ] + ".oi" )
461- savefile = shutil .copy (str (savestate .standardFilePath + " \\ autosave.xml" ), file )
508+ savefile = shutil .copy (str (savestate .standardFilePath + savestate . symbol + " autosave.xml" ), file )
462509
463510
464511def loadConfig (self , basefilepath ):
@@ -474,8 +521,8 @@ def loadConfig(self, basefilepath):
474521 logWrite ("Trying to parse input file..." )
475522
476523 # delete old textfiles and create a new empty folder
477- emptyDir (basefilepath + " \\ textfiles" )
478- os .mkdir (basefilepath + " \\ textfiles" )
524+ emptyDir (basefilepath + savestate . symbol + " textfiles" )
525+ os .mkdir (basefilepath + savestate . symbol + " textfiles" )
479526 logWrite ("Deleted old textfiles and created a fresh folder!\n " )
480527
481528 # After parsing we need to get the values for each field. Then we put it in the list. Sorry for the naming here,
@@ -533,7 +580,7 @@ def setFilePath(self, oldpath):
533580 if len (text ) > 0 :
534581 if ":" in text :
535582 # delete the old textfiles folder so theres no garbage floating around
536- emptyDir (oldpath + " \\ textfiles" )
583+ emptyDir (oldpath + savestate . symbol + " textfiles" )
537584
538585 setNewFilePath (self , text )
539586
@@ -545,21 +592,18 @@ def setFilePath(self, oldpath):
545592
546593
547594def setNewFilePath (self , path ):
548-
549595 # initialize the file path and create the standard files at that location
550596 print (path )
551597 logWrite ("New textfilepath will be " + str (path ))
552598 createStandardFiles (path , 1 )
553599
554-
555-
556600 logWrite ("Created the new textfiles at new path" )
557601 # set the new filepath into the xml document so it gets saved for the next startup
558- tree = ET .parse (standardFilePath + " \\ config.xml" )
602+ tree = ET .parse (standardFilePath + savestate . symbol + " config.xml" )
559603 root = tree .getroot ()
560604
561605 root [0 ][0 ].set ("path" , path )
562- tree .write (standardFilePath + " \\ config.xml" )
606+ tree .write (standardFilePath + savestate . symbol + " config.xml" )
563607 print (root [0 ][0 ].attrib )
564608
565609 # reset the two list widgets and reload the items from the xml
0 commit comments