From c161417a412214b7e6e642774f6294e39435bb31 Mon Sep 17 00:00:00 2001 From: JezerM Date: Mon, 13 Sep 2021 16:04:24 -0600 Subject: [PATCH] Bugfix --- web-greeter/bridge/Greeter.py | 4 +++- web-greeter/browser/browser.py | 30 +++++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/web-greeter/bridge/Greeter.py b/web-greeter/bridge/Greeter.py index 6e89e90..619a97d 100644 --- a/web-greeter/bridge/Greeter.py +++ b/web-greeter/bridge/Greeter.py @@ -164,6 +164,8 @@ class Greeter(BridgeObject): def _determine_shared_data_directory_path(self): user = LightDMUsers.get_users()[0] user_data_dir = LightDMGreeter.ensure_shared_data_dir_sync(user.get_name()) + if user_data_dir == None: + return self._shared_data_directory = user_data_dir.rpartition('/')[0] def _connect_signals(self): @@ -320,7 +322,7 @@ class Greeter(BridgeObject): @Bridge.prop(str, notify=noop_signal) def shared_data_directory(self): - return self._shared_data_directory + return self._shared_data_directory or '' @Bridge.prop(bool, notify=noop_signal) def show_manual_login_hint(self): diff --git a/web-greeter/browser/browser.py b/web-greeter/browser/browser.py index 5a52ca9..974912b 100644 --- a/web-greeter/browser/browser.py +++ b/web-greeter/browser/browser.py @@ -38,8 +38,8 @@ from typing import ( ) # 3rd-Party Libs -from PyQt5.QtCore import QUrl, Qt, QCoreApplication, QFile -from PyQt5.QtWidgets import QAction, QApplication, QDesktopWidget, QDockWidget, QMainWindow, qApp +from PyQt5.QtCore import QRect, QUrl, Qt, QCoreApplication, QFile, QSize +from PyQt5.QtWidgets import QAction, QApplication, QDesktopWidget, QDockWidget, QMainWindow, QLayout, qApp, QWidget from PyQt5.QtWebEngineCore import QWebEngineUrlScheme from PyQt5.QtWebEngineWidgets import QWebEngineScript, QWebEngineProfile, QWebEngineSettings, QWebEngineView, QWebEnginePage from PyQt5.QtGui import QColor, QIcon @@ -112,7 +112,6 @@ class Application: self.window.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) self.window.setWindowTitle("Web Greeter") - self.window.setWindowFlags(self.window.windowFlags() | Qt.WindowType.FramelessWindowHint) self.window.setWindowFlags( self.window.windowFlags() | Qt.WindowType.MaximizeUsingFullscreenGeometryHint @@ -120,8 +119,10 @@ class Application: if web_greeter_config["app"]["frame"]: self._init_menu_bar() + else: + self.window.setWindowFlags(self.window.windowFlags() | Qt.WindowType.FramelessWindowHint) - screen_size = self.desktop.screen().size() + screen_size = self.desktop.availableGeometry().size() self.window.setBaseSize(screen_size) self.window.resize(screen_size) @@ -178,6 +179,17 @@ class Application: about_menu = menu_bar.addMenu('&About') about_menu.addAction(exit_action) +class NoneLayout(QLayout): + def __init__(self): + super().__init__() + + def sizeHint(self) -> QSize: + size = QSize(0, 0) + return size + + def minimumSizeHint(self) -> QSize: + size = QSize(0, 0) + return size class Browser(Application): @@ -252,7 +264,10 @@ class Browser(Application): self.qdock = QDockWidget() self.qdock.setWidget(self.dev_view) - self.qdock.setMinimumWidth(int(self.window.width() / 2)) + titlebar = QWidget(self.qdock) + layout = NoneLayout() + titlebar.setLayout(layout) + self.qdock.setTitleBarWidget(titlebar) self.window.addDockWidget(Qt.DockWidgetArea.RightDockWidgetArea, self.qdock) self.qdock.hide() @@ -261,6 +276,11 @@ class Browser(Application): def toggle_devtools(self): if not web_greeter_config["config"]["greeter"]["debug_mode"]: return + win_size = self.window.size() + # dev_size = self.qdock.size() + + self.qdock.resize(int(win_size.width() / 2), int(win_size.height())) + if self.qdock.isVisible(): self.qdock.hide() self.view.setFocus()