Skip to content

Commit

Permalink
Merge pull request #70 from tokejepsen/master
Browse files Browse the repository at this point in the history
Single persistent window.
  • Loading branch information
tokejepsen authored Oct 13, 2016
2 parents 6bcda8a + b99341e commit a87f286
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
26 changes: 22 additions & 4 deletions pyblish_lite/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import contextlib

from .vendor.Qt import QtWidgets, QtGui
from . import control, util, window, compat
from . import control, util, window, compat, settings

self = sys.modules[__name__]
self._window = None


@contextlib.contextmanager
Expand Down Expand Up @@ -52,9 +55,24 @@ def show(parent=None):

ctrl = control.Controller()

win = window.Window(ctrl, parent)
win.resize(430, 600)
win.show()
win = None

if self._window:
win = self._window
win.show()
win.activateWindow()
print "Using existing window..."
else:
win = window.Window(ctrl, parent)
win.resize(430, 600)
win.show()
self._window = win
print "Creating new window..."

if not win:
raise ValueError("Could not get window.")

win.setWindowTitle(settings.WindowTitle)

font = win.font()
font.setFamily("Open Sans")
Expand Down
2 changes: 1 addition & 1 deletion pyblish_lite/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

VERSION_MAJOR = 0
VERSION_MINOR = 5
VERSION_MINOR = 6
VERSION_PATCH = 0

version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
Expand Down
2 changes: 1 addition & 1 deletion pyblish_lite/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def __init__(self, controller, parent=None):
QtCore.Qt.WindowMaximizeButtonHint |
QtCore.Qt.WindowMinimizeButtonHint |
QtCore.Qt.WindowCloseButtonHint)
self.setWindowTitle(settings.WindowTitle)
self.setWindowIcon(icon)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

self.controller = controller

Expand Down

0 comments on commit a87f286

Please sign in to comment.