Fix window pos issue on minimal

This commit is contained in:
2016-01-24 00:04:07 +05:30
parent 2afb5589cd
commit 151d3ac39a
2 changed files with 8 additions and 10 deletions
@@ -24,11 +24,6 @@ class Controller(htmlPy.Object):
"minimal": "minimal.html", "minimal": "minimal.html",
} }
dict_tmpl_size = {
"default": (150, 80),
"minimal": (50, 50)
}
def __init__(self, app_gui): def __init__(self, app_gui):
super(Controller, self).__init__() super(Controller, self).__init__()
self.i = 0 self.i = 0
@@ -40,10 +35,6 @@ class Controller(htmlPy.Object):
raise TypeError("template name must be valid, one of these: {allowed_tmpl_names}".format( raise TypeError("template name must be valid, one of these: {allowed_tmpl_names}".format(
allowed_tmpl_names=(", ".join(self.dict_tmpl.keys())))) allowed_tmpl_names=(", ".join(self.dict_tmpl.keys()))))
# set correct width, height
# self.app_gui.window.minimumWidth, self.app_gui.window.minimumHeight = (0, 0)
self.app_gui.width, self.app_gui.height = self.dict_tmpl_size.get(self.app_gui.tmpl_name)
@htmlPy.Slot() @htmlPy.Slot()
def redraw(self): def redraw(self):
redis_db = redis.StrictRedis(host='localhost', port=REDIS_PORT, db=0) redis_db = redis.StrictRedis(host='localhost', port=REDIS_PORT, db=0)
+8 -1
View File
@@ -8,6 +8,11 @@ import argparse
# Import back-end functionalities # Import back-end functionalities
from gui_backend import Controller from gui_backend import Controller
dict_tmpl_size = {
"default": (150, 80),
"minimal": (50, 50)
}
def main(): def main():
arg_parser = argparse.ArgumentParser() arg_parser = argparse.ArgumentParser()
@@ -32,7 +37,10 @@ def main():
app.window.setWindowFlags(QtCore.Qt.WindowTitleHint) app.window.setWindowFlags(QtCore.Qt.WindowTitleHint)
# app.window.setWindowFlags(app.window.windowFlags() & ~QtCore.Qt.WindowMaximizeButtonHint) # app.window.setWindowFlags(app.window.windowFlags() & ~QtCore.Qt.WindowMaximizeButtonHint)
app.window.setWindowFlags(app.window.windowFlags() | QtCore.Qt.WindowStaysOnTopHint) app.window.setWindowFlags(app.window.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
app.tmpl_name = app_tmpl
# set correct width, height
app.width, app.height = dict_tmpl_size.get(app.tmpl_name)
screen_geo = QApplication.desktop().availableGeometry() screen_geo = QApplication.desktop().availableGeometry()
screen_topright = screen_geo.topRight() screen_topright = screen_geo.topRight()
app.x_pos = (screen_topright.x() - 20) - app.width app.x_pos = (screen_topright.x() - 20) - app.width
@@ -43,7 +51,6 @@ def main():
app.static_path = os.path.join(BASE_DIR, "static/") app.static_path = os.path.join(BASE_DIR, "static/")
app.template_path = os.path.join(BASE_DIR, "tmpl/") app.template_path = os.path.join(BASE_DIR, "tmpl/")
app.dir_name = dir_name app.dir_name = dir_name
app.tmpl_name = app_tmpl
# Register back-end functionalities # Register back-end functionalities
# allow minimal tmpl with sys.arg # allow minimal tmpl with sys.arg