Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenGEODE
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
TASTE
OpenGEODE
Commits
fa063c1f
Commit
fa063c1f
authored
Apr 04, 2019
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set up store/restore geometry
parent
44cdf21d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
opengeode/opengeode.py
opengeode/opengeode.py
+22
-2
No files found.
opengeode/opengeode.py
View file @
fa063c1f
...
...
@@ -268,6 +268,7 @@ class File_toolbar(QtGui.QToolBar, object):
def
__init__
(
self
,
parent
):
''' Create the toolbar using standard icons '''
super
(
File_toolbar
,
self
).
__init__
(
parent
)
self
.
setObjectName
(
"File Toolbar"
)
# needed to save geometry
self
.
setMovable
(
False
)
self
.
setFloatable
(
False
)
self
.
new_button
=
self
.
addAction
(
self
.
style
().
standardIcon
(
...
...
@@ -296,6 +297,7 @@ class Sdl_toolbar(QtGui.QToolBar, object):
def
__init__
(
self
,
parent
):
''' Create the toolbar, get icons and link actions '''
super
(
Sdl_toolbar
,
self
).
__init__
(
parent
)
self
.
setObjectName
(
"SDL Toolbar"
)
# needed to save geometry
self
.
setMovable
(
False
)
self
.
setFloatable
(
False
)
self
.
setIconSize
(
QSize
(
35
,
35
))
...
...
@@ -2470,7 +2472,6 @@ class OG_MainWindow(QtGui.QMainWindow, object):
self
.
statechart_mdi
=
None
self
.
current_window
=
None
self
.
datadict
=
None
self
.
setWindowState
(
Qt
.
WindowMaximized
)
def
new_scene
(
self
,
readonly
=
False
):
''' Create a new, clean SDL scene. This function is necessary because
...
...
@@ -2625,6 +2626,8 @@ class OG_MainWindow(QtGui.QMainWindow, object):
# Create a default context - at Block level - for the autocompleter
sdlSymbols
.
CONTEXT
=
ogAST
.
Block
()
self
.
update_datadict_window
()
# After file was loaded, try to restore window geometry
self
.
restoreApplicationState
()
@
QtCore
.
Slot
(
QtGui
.
QMdiSubWindow
)
def
upd_statechart
(
self
,
mdi
):
...
...
@@ -2845,10 +2848,17 @@ class OG_MainWindow(QtGui.QMainWindow, object):
# pylint: disable=C0103
def
closeEvent
(
self
,
event
):
''' Close main application '''
''' Close main application
after saving application state
'''
if
not
self
.
view
.
is_model_clean
()
and
not
self
.
view
.
propose_to_save
():
event
.
ignore
()
else
:
# save windows geometry to a setting file
if
self
.
view
.
filename
:
ini_filename
=
self
.
view
.
filename
+
".ini"
settings
=
QSettings
(
ini_filename
,
QSettings
.
IniFormat
)
settings
.
setValue
(
'geometry'
,
self
.
saveGeometry
())
settings
.
setValue
(
'windowState'
,
self
.
saveState
())
# Clear the list of top-level symbols to avoid possible exit-crash
# due to pyside badly handling items that are not part of any scene
G_SYMBOLS
.
clear
()
...
...
@@ -2858,6 +2868,16 @@ class OG_MainWindow(QtGui.QMainWindow, object):
each
.
undo_stack
.
clear
()
super
(
OG_MainWindow
,
self
).
closeEvent
(
event
)
def
restoreApplicationState
(
self
):
''' Restore windows geometry and state '''
if
self
.
view
.
filename
:
ini_filename
=
self
.
view
.
filename
+
".ini"
settings
=
QSettings
(
ini_filename
,
QSettings
.
IniFormat
)
self
.
restoreGeometry
(
settings
.
value
(
'geometry'
))
self
.
restoreState
(
settings
.
value
(
'windowState'
))
else
:
self
.
setWindowState
(
Qt
.
WindowMaximized
)
class
FilterEvent
(
QtCore
.
QObject
):
def
eventFilter
(
self
,
obj
,
event
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment