From a43aa5f68c83b753e6f29e2def8b51da273268c2 Mon Sep 17 00:00:00 2001 From: Abhas Bhattacharya Date: Sat, 23 Jan 2016 23:14:38 +0530 Subject: [PATCH] Revert window pos set to start + add tmpl_name to all fake_app_gui --- pytest_gui_status/status_gui/gui_backend.py | 5 ----- pytest_gui_status/status_gui/gui_frontend.py | 6 ++++++ tests/test_gui/test_gui.py | 6 ++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pytest_gui_status/status_gui/gui_backend.py b/pytest_gui_status/status_gui/gui_backend.py index 725910e..597787d 100644 --- a/pytest_gui_status/status_gui/gui_backend.py +++ b/pytest_gui_status/status_gui/gui_backend.py @@ -44,11 +44,6 @@ class Controller(htmlPy.Object): # 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) - screen_geo = QApplication.desktop().availableGeometry() - screen_topright = screen_geo.topRight() - self.app_gui.x_pos = (screen_topright.x() - 20) - self.app_gui.width - self.app_gui.y_pos = (screen_topright.y() + 20) - @htmlPy.Slot() def redraw(self): redis_db = redis.StrictRedis(host='localhost', port=REDIS_PORT, db=0) diff --git a/pytest_gui_status/status_gui/gui_frontend.py b/pytest_gui_status/status_gui/gui_frontend.py index 4d0223c..ed3f189 100644 --- a/pytest_gui_status/status_gui/gui_frontend.py +++ b/pytest_gui_status/status_gui/gui_frontend.py @@ -2,6 +2,7 @@ import htmlPy import os import PyQt4.QtCore as QtCore +from PyQt4.QtGui import QApplication import argparse # Import back-end functionalities @@ -32,6 +33,11 @@ def main(): # app.window.setWindowFlags(app.window.windowFlags() & ~QtCore.Qt.WindowMaximizeButtonHint) app.window.setWindowFlags(app.window.windowFlags() | QtCore.Qt.WindowStaysOnTopHint) + screen_geo = QApplication.desktop().availableGeometry() + screen_topright = screen_geo.topRight() + app.x_pos = (screen_topright.x() - 20) - app.width + app.y_pos = (screen_topright.y() + 20) + # GUI configarg BASE_DIR = os.path.abspath(os.path.dirname(__file__)) app.static_path = os.path.join(BASE_DIR, "static/") diff --git a/tests/test_gui/test_gui.py b/tests/test_gui/test_gui.py index f8d1967..e1a519b 100644 --- a/tests/test_gui/test_gui.py +++ b/tests/test_gui/test_gui.py @@ -73,6 +73,7 @@ class TestRedisFail(object): # mock Controller requirements and app_gui.stop fake_app_gui = MagicMock() + fake_app_gui.tmpl_name = "default" with pytest.raises(redis.exceptions.ConnectionError) as error_info: gui_backend.Controller(fake_app_gui).redraw() @@ -97,6 +98,7 @@ class TestRedisFail(object): # mock Controller requirements and app_gui.stop fake_app_gui = MagicMock() + fake_app_gui.tmpl_name = "default" with pytest.raises(redis.exceptions.ConnectionError) as error_info: gui_backend.Controller(fake_app_gui).redraw() @@ -123,6 +125,7 @@ class TestRedisFail(object): # mock Controller requirements and app_gui.stop fake_app_gui = MagicMock() + fake_app_gui.tmpl_name = "default" with pytest.raises(redis.exceptions.ConnectionError) as error_info: gui_backend.Controller(fake_app_gui).redraw() @@ -149,6 +152,7 @@ class TestRedisFail(object): # mock Controller requirements and app_gui.stop # provide invalid path fake_app_gui = MagicMock() + fake_app_gui.tmpl_name = "default" fake_app_gui.dir_name = r"Invalid/Path" with pytest.raises(redis.exceptions.ConnectionError) as error_info: @@ -185,6 +189,7 @@ class TestBackendState(object): # mock app_gui with path fake_app_gui = MagicMock() + fake_app_gui.tmpl_name = "default" fake_app_gui.dir_name = tmpdir.strpath tmp_controller = gui_backend.Controller(fake_app_gui) @@ -224,6 +229,7 @@ class TestBackendState(object): # mock app_gui with path fake_app_gui = MagicMock() + fake_app_gui.tmpl_name = "default" fake_app_gui.dir_name = tmpdir.strpath tmp_controller = gui_backend.Controller(fake_app_gui)