eryar / PipeCAD

PipeCAD - Plant Piping Design Software.
https://eryar.github.io/PipeCAD/
Other
92 stars 18 forks source link

Core - Moving Start/Commit Transaction to Core.Savework #45

Closed rompik closed 2 years ago

rompik commented 2 years ago

Before doing any modification in Python code there is need to open session and after close and save it. But I think as starting/committing of transaction is required for proper writing to database will be better to merge 3 operation into one and hide it in the Core method. So Python code will be changed from:

PipeCad.StartTransaction("Some comment")  

# Here is block of modification in database

PipeCad.CommitTransaction()
PipeCad.SaveWork() 

to just savework:

# Here is block of modification in database

PipeCad.SaveWork() 

So when user open PipeCAD, Core will start transaction automatically. When user want to save changes, he will use only command PipeCAD.Savework() and Core will COMMIT TRANSACTION, do SAVEWORK and START new TRANSACTION in the one Core's method PipeCAD.Savework() automatically.

eryar commented 2 years ago
PipeCad.StartTransaction("Some comment") 
PipeCad.CommitTransaction()

The start/commit transaction will combine all modification into one command for undo/redo. It is not needed before doing any modification just when you think that all the modification can be undo/redo once.

rompik commented 2 years ago

Ok, understand. Not sure that developers will use it for scripts (it's only my experience), but in any way lets remains "as is":)

eryar commented 2 years ago
PipeCad.StartTransaction("Some comment") 
PipeCad.CommitTransaction()

Like in PDMS use macro:

MARKDB 'text'
ENDMARKDB

I think developers will use it when they want to combine all modification in one undo/redo.

rompik commented 2 years ago

Didn't know about such possibility in PDMS. Usually undo/redo mechanism was horrible in PDMS, so we tried to don't use it.

eryar commented 2 years ago

Okay.