summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrenda-br2023-03-02 17:47:08 +0530
committerbrenda-br2023-03-02 17:47:08 +0530
commitc9cf87cd94d97c2166e3acdaec8f638c11d4a779 (patch)
tree02ba055d359ea6c2e46793a193892df0ad560639
parent7af3526e105cc330422f8742ec5edec1c4a0a98f (diff)
downloadChemical-Simulator-GUI-c9cf87cd94d97c2166e3acdaec8f638c11d4a779.tar.gz
Chemical-Simulator-GUI-c9cf87cd94d97c2166e3acdaec8f638c11d4a779.tar.bz2
Chemical-Simulator-GUI-c9cf87cd94d97c2166e3acdaec8f638c11d4a779.zip
Commenting Undo and Redo Functions
-rw-r--r--Chemical Simulator GUI.exebin57150217 -> 57148865 bytes
-rw-r--r--Container.py6
-rw-r--r--Graphics.py26
-rw-r--r--Redo.dat0
-rw-r--r--Undo.dat0
-rw-r--r--mainApp.py126
6 files changed, 79 insertions, 79 deletions
diff --git a/Chemical Simulator GUI.exe b/Chemical Simulator GUI.exe
index c615efb..3ca8fd0 100644
--- a/Chemical Simulator GUI.exe
+++ b/Chemical Simulator GUI.exe
Binary files differ
diff --git a/Container.py b/Container.py
index 7a845a8..8de7b95 100644
--- a/Container.py
+++ b/Container.py
@@ -45,7 +45,7 @@ class Container():
self.unit_operations.append(obj)
data = self.unit_operations[:]
data.append(compound_selected)
- push('Undo', data)
+ #push('Undo', data)
self.msg.append("<span style=\"color:blue\">["+str(self.current_time())+"]<b> "+obj.name+" </b>is instantiated .""</span>")
'''
@@ -87,10 +87,10 @@ class Container():
del item.obj
del item
- clean_file('Redo')
+ #clean_file('Redo')
data = self.unit_operations[:]
data.append(compound_selected)
- push('Undo', data)
+ #push('Undo', data)
def fetch_object(self,name):
for i in self.unit_operations:
diff --git a/Graphics.py b/Graphics.py
index 16a4189..4779a12 100644
--- a/Graphics.py
+++ b/Graphics.py
@@ -396,19 +396,19 @@ class NodeSocket(QtWidgets.QGraphicsItem):
del self.new_line
super(NodeSocket, self).mouseReleaseEvent(event)
- try:
- data = get_last_list('Undo')
- comp_selected = data[-1]
- data.remove(comp_selected)
- for i in range(len(data)):
- if data[i].name == self.new_line.source.parent.obj.name:
- data[i] = self.new_line.source.parent.obj
- elif data[i].name == self.new_line.target.parent.obj.name:
- data[i] = self.new_line.target.parent.obj
- data.append(comp_selected)
- push('Undo', data)
- except Exception as e:
- print(e)
+ # try:
+ # data = get_last_list('Undo')
+ # comp_selected = data[-1]
+ # data.remove(comp_selected)
+ # for i in range(len(data)):
+ # if data[i].name == self.new_line.source.parent.obj.name:
+ # data[i] = self.new_line.source.parent.obj
+ # elif data[i].name == self.new_line.target.parent.obj.name:
+ # data[i] = self.new_line.target.parent.obj
+ # data.append(comp_selected)
+ # push('Undo', data)
+ # except Exception as e:
+ # print(e)
def get_center(self):
rect = self.boundingRect()
diff --git a/Redo.dat b/Redo.dat
deleted file mode 100644
index e69de29..0000000
--- a/Redo.dat
+++ /dev/null
diff --git a/Undo.dat b/Undo.dat
deleted file mode 100644
index e69de29..0000000
--- a/Undo.dat
+++ /dev/null
diff --git a/mainApp.py b/mainApp.py
index 7c9b55f..e83d4c3 100644
--- a/mainApp.py
+++ b/mainApp.py
@@ -82,10 +82,10 @@ class MainApp(QMainWindow,ui):
self.actionSequentialMode.setShortcut('Ctrl+M')
self.actionEquationOriented.triggered.connect(partial(self.simulate,'EQN'))
self.actionEquationOriented.setShortcut('Ctrl+E')
- self.actionUndo.triggered.connect(self.undo)
- self.actionUndo.setShortcut('Ctrl+Z')
- self.actionRedo.triggered.connect(self.redo)
- self.actionRedo.setShortcut('Ctrl+Y')
+ #self.actionUndo.triggered.connect(self.undo)
+ # self.actionUndo.setShortcut('Ctrl+Z')
+ # #self.actionRedo.triggered.connect(self.redo)
+ # self.actionRedo.setShortcut('Ctrl+Y')
self.actionSave.triggered.connect(self.save)
self.actionSave.setShortcut('Ctrl+S')
self.actionOpen.triggered.connect(self.open)
@@ -232,7 +232,7 @@ class MainApp(QMainWindow,ui):
'''
def new(self):
self.setWindowTitle('Untitled - Chemical Simulator GUI')
- self.undo_redo_helper()
+ #self.undo_redo_helper()
self.comp = ComponentSelector(self)
self.textBrowser.append("<span>[" + str(self.current_time()) + "] <b>New</b> flowsheet is created ... </span>")
dock_widget_lst.clear()
@@ -248,61 +248,61 @@ class MainApp(QMainWindow,ui):
except Exception as e:
print(e)
- '''
- It helps by clearing screen and loading the objects by undo redo methods
- '''
- def undo_redo_helper(self):
- for i in self.container.unit_operations:
- type(i).counter = 1
- self.container = None
- for i in dock_widget_lst:
- i.hide()
- del i
- lst.clear()
- self.container = Container(self.textBrowser, self.graphicsView)
-
- compound_selected.clear()
- self.scene = self.container.graphics.get_scene()
- self.graphicsView.setScene(self.scene)
- self.graphicsView.setMouseTracking(True)
- self.graphicsView.keyPressEvent=self.delete_call
-
- '''
- Function for undo
- '''
- def undo(self):
- redo_data = pop('Undo')
- if redo_data is not None:
- push('Redo', redo_data)
- undo_data = get_last_list('Undo')
- messages = self.textBrowser.toPlainText()
- try:
- self.undo_redo_helper()
- self.container.graphics.load_canvas(undo_data, self.container)
- self.textBrowser.setText(messages)
- except Exception as e:
- print(e)
- self.textBrowser.append(messages)
- else:
- messages = self.textBrowser.toPlainText()
- self.textBrowser.setText(messages)
- self.textBrowser.append("<span>[" + str(self.current_time()) + "] <b>No more undo can be done!</b>... </span>")
-
- '''
- Function for redo
- '''
- def redo(self):
- redo_data = pop('Redo')
- if redo_data is not None:
- push('Undo', redo_data)
- messages = self.textBrowser.toPlainText()
- self.undo_redo_helper()
- self.container.graphics.load_canvas(redo_data, self.container)
- self.textBrowser.setText(messages)
- else:
- messages = self.textBrowser.toPlainText()
- self.textBrowser.setText(messages)
- self.textBrowser.append("<span>[" + str(self.current_time()) + "] <b>No more redo can be done!</b>... </span>")
+ # '''
+ # It helps by clearing screen and loading the objects by undo redo methods
+ # '''
+ # def undo_redo_helper(self):
+ # for i in self.container.unit_operations:
+ # type(i).counter = 1
+ # self.container = None
+ # for i in dock_widget_lst:
+ # i.hide()
+ # del i
+ # lst.clear()
+ # self.container = Container(self.textBrowser, self.graphicsView)
+
+ # compound_selected.clear()
+ # self.scene = self.container.graphics.get_scene()
+ # self.graphicsView.setScene(self.scene)
+ # self.graphicsView.setMouseTracking(True)
+ # self.graphicsView.keyPressEvent=self.delete_call
+
+ # '''
+ # Function for undo
+ # '''
+ # def undo(self):
+ # redo_data = pop('Undo')
+ # if redo_data is not None:
+ # push('Redo', redo_data)
+ # undo_data = get_last_list('Undo')
+ # messages = self.textBrowser.toPlainText()
+ # try:
+ # self.undo_redo_helper()
+ # self.container.graphics.load_canvas(undo_data, self.container)
+ # self.textBrowser.setText(messages)
+ # except Exception as e:
+ # print(e)
+ # self.textBrowser.append(messages)
+ # else:
+ # messages = self.textBrowser.toPlainText()
+ # self.textBrowser.setText(messages)
+ # self.textBrowser.append("<span>[" + str(self.current_time()) + "] <b>No more undo can be done!</b>... </span>")
+
+ # '''
+ # Function for redo
+ # '''
+ # def redo(self):
+ # redo_data = pop('Redo')
+ # if redo_data is not None:
+ # push('Undo', redo_data)
+ # messages = self.textBrowser.toPlainText()
+ # self.undo_redo_helper()
+ # self.container.graphics.load_canvas(redo_data, self.container)
+ # self.textBrowser.setText(messages)
+ # else:
+ # messages = self.textBrowser.toPlainText()
+ # self.textBrowser.setText(messages)
+ # self.textBrowser.append("<span>[" + str(self.current_time()) + "] <b>No more redo can be done!</b>... </span>")
'''
Function for saving the current canvas items and compound_selected
@@ -343,7 +343,7 @@ class MainApp(QMainWindow,ui):
fileName = file_name.split('/')[-1].split('.')[0]
self.setWindowTitle(fileName+' - Chemical Simulator GUI')
- self.undo_redo_helper()
+ #self.undo_redo_helper()
with open(file_name, 'rb') as f:
obj = pickle.load(f)
@@ -396,8 +396,8 @@ class MainApp(QMainWindow,ui):
def main():
- clean_file('Undo')
- clean_file('Redo')
+ # clean_file('Undo')
+ # clean_file('Redo')
app = QApplication(sys.argv)
window = MainApp()