aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorsuchinton2001 <suchinton.2001@gmail.com>2023-10-26 18:11:52 +0530
committersuchinton2001 <suchinton.2001@gmail.com>2023-10-26 19:39:05 +0530
commitbd1185376275b24ac00404c1f36c041e8ebb5e47 (patch)
tree8fe46cf8f19d33948ebcd073832ab45d8853ffdf /extras
parentae721f6bb4ed29f2b7f4a54dc4e0c583f5fc7e21 (diff)
agl-demo-control-panel: Add Fullscreen / maximized option
V1: - Add fullscreen flag in config.ini to hide the header bar and launch the control-center in fullscreen mode. V2: - Write default user-session config if not found in config.ini Bug-AGL: SPEC-4948 Signed-off-by: suchinton2001 <suchinton.2001@gmail.com> Change-Id: I549390711cdda95f99ee166d99c302176d105f1f
Diffstat (limited to 'extras')
-rw-r--r--extras/UI_Handeler.py5
-rw-r--r--extras/config.ini10
-rw-r--r--extras/config.py34
3 files changed, 38 insertions, 11 deletions
diff --git a/extras/UI_Handeler.py b/extras/UI_Handeler.py
index fa2c3a8..a44cf1a 100644
--- a/extras/UI_Handeler.py
+++ b/extras/UI_Handeler.py
@@ -32,6 +32,11 @@ block_subscription_updates = False
class UI_Handeler(MainWindow):
+ def fullscreen(self):
+ self.headerContainer.hide()
+ self.setAttribute(QtCore.Qt.WA_TranslucentBackground, False)
+ self.showFullScreen()
+
def display_sending_message(self):
print("message sent")
diff --git a/extras/config.ini b/extras/config.ini
index 1c367f9..54e3424 100644
--- a/extras/config.ini
+++ b/extras/config.ini
@@ -1,5 +1,15 @@
[default]
preferred-config=user-session
+fullscreen-mode=true
+
+[user-session]
+ip =
+port =
+protocol =
+insecure =
+tls_server_name =
+token = default
+cacert = default
# [cutom-config-template]
# ip=<ip address>
diff --git a/extras/config.py b/extras/config.py
index 48a63e2..1a10719 100644
--- a/extras/config.py
+++ b/extras/config.py
@@ -52,21 +52,17 @@ GRPC_TOKEN_PATHS = check_paths(
)
config = ConfigParser()
-config_path = next(
- (path for path, exists in CONFIG_PATHS.items() if exists), None)
+config_path = next((path for path, exists in CONFIG_PATHS.items() if exists), None)
if config_path:
config.read(config_path)
CA_PATH = next((path for path, exists in CA_PATHS.items() if exists), None)
-WS_TOKEN = next(
- (path for path, exists in WS_TOKEN_PATHS.items() if exists), None)
-GRPC_TOKEN = next(
- (path for path, exists in GRPC_TOKEN_PATHS.items() if exists), None)
+WS_TOKEN = next((path for path, exists in WS_TOKEN_PATHS.items() if exists), None)
+GRPC_TOKEN = next((path for path, exists in GRPC_TOKEN_PATHS.items() if exists), None)
KUKSA_CONFIG = {}
KUKSA_TOKEN = None
-
def select_config(preferred_config):
"""
Selects a configuration from the config.ini file based on the preferred_config parameter.
@@ -131,8 +127,6 @@ def save_session_config(session_config, auth_token, CA_File=None):
"""
save values to config.ini under [user-session]
"""
- if not config.has_section('user-session'):
- config.add_section('user-session')
config.set('user-session', 'ip', str(session_config['ip']))
config.set('user-session', 'port', str(session_config['port']))
@@ -140,15 +134,33 @@ def save_session_config(session_config, auth_token, CA_File=None):
config.set('user-session', 'insecure', str(session_config['insecure']))
config.set('user-session', 'tls_server_name',
str(session_config['tls_server_name']))
- if auth_token in WS_TOKEN_PATHS or auth_token in GRPC_TOKEN_PATHS:
+ if auth_token in WS_TOKEN_PATHS or auth_token in GRPC_TOKEN_PATHS or auth_token == 'default':
config.set('user-session', 'token', 'default')
else:
config.set('user-session', 'token', str(auth_token))
- if CA_File in CA_PATHS:
+ if CA_File in CA_PATHS or CA_File == 'default':
config.set('user-session', 'cacert', 'default')
else:
config.set('user-session', 'cacert', str(CA_File))
with open(config_path, 'w') as configfile:
config.write(configfile)
+
+
+def fullscreen_mode():
+ return config.getboolean('default', 'fullscreen-mode')
+
+
+if not config.has_section('user-session'):
+ config.add_section('user-session')
+ temp = {
+ 'ip': "",
+ 'port': "",
+ 'protocol': "",
+ 'insecure': "",
+ 'cacert': "",
+ 'token': "",
+ 'tls_server_name': "",
+ }
+ save_session_config(temp, 'default', 'default') \ No newline at end of file