From 0a2f4ce4a41c0334c8aaf2e27e1ea9c16c4634d3 Mon Sep 17 00:00:00 2001 From: Joey Payne Date: Fri, 10 Apr 2015 15:34:19 -0600 Subject: [PATCH] Added "kiosk" and "show" options. --- command_line.py | 1 + files/settings.cfg | 20 +++++++++++++++++--- main.py | 47 ++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 61 insertions(+), 7 deletions(-) diff --git a/command_line.py b/command_line.py index 2e207ec..7e06fc1 100644 --- a/command_line.py +++ b/command_line.py @@ -98,6 +98,7 @@ class Setting(object): self.values = kwargs.pop('values', []) self.filter = kwargs.pop('filter', '(?s).*') self.filter_action = kwargs.pop('filter_action', 'None') + self.check_action = kwargs.pop('check_action', 'None') self.set_extra_attributes_from_keyword_args(**kwargs) diff --git a/files/settings.cfg b/files/settings.cfg index 930b62c..7391c09 100644 --- a/files/settings.cfg +++ b/files/settings.cfg @@ -165,6 +165,11 @@ linux_64_dir_prefix = 'node-webkit-v{}-linux-x64' default_value=True type='check' description='Hide the app running in the taskbar' + [[[show]]] + display_name='Show' + default_value=True + type='check' + description='Uncheck to make your app hidden on startup.' [[[visible]]] default_value=True type='check' @@ -191,11 +196,20 @@ linux_64_dir_prefix = 'node-webkit-v{}-linux-x64' default_value=False type='check' description='Allows window tranparency.' + [[[kiosk]]] + default_value=False + type='check' + description='Puts the application is kiosk mode.' + [[[kiosk_emulation]]] + default_value=False + type='check' + description='Puts the application is kiosk emulation mode. Will automatically check off required settings that will emulate kiosk.' + check_action='set_kiosk_emulation_options' [[download_settings]] [[[nw_version]]] display_name='Node-webkit version' - default_value='0.9.2' + default_value='0.12.0' values=[] type='list' button='Update' @@ -324,8 +338,8 @@ linux_64_dir_prefix = 'node-webkit-v{}-linux-x64' window_setting_order = """['title', 'icon', 'mac_icon', 'exe_icon', 'position', 'width', 'height', 'min_width', 'min_height', 'max_width', 'max_height', 'toolbar', 'always-on-top', 'frame', - 'show_in_taskbar', 'visible', 'resizable', 'fullscreen', 'as_desktop', - 'transparent']""" + 'show_in_taskbar', 'show', 'visible', 'resizable', 'fullscreen', 'as_desktop', + 'kiosk', 'transparent']""" export_setting_order = """['windows-x32', 'windows-x64', 'mac-x32', 'mac-x64', 'linux-x64', 'linux-x32']""" diff --git a/main.py b/main.py index 1c90bc0..696cd6d 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,6 @@ from utils import log, open_folder_in_explorer -__gui_version__ = "v0.1.17b" +__gui_version__ = "v0.2.0b" import os import re @@ -13,7 +13,7 @@ from PySide.QtNetwork import QHttp from PySide.QtCore import QUrl, QFile, QIODevice, QCoreApplication -from command_line import CWD, CommandBase +from command_line import CWD, CommandBase, logger class Validator(QtGui.QRegExpValidator): @@ -50,9 +50,16 @@ class MainWindow(QtGui.QWidget, CommandBase): def update_nw_versions(self, button): self.get_versions_in_background() - def __init__(self, width, height, parent=None): + def __init__(self, width, height, app, parent=None): super(MainWindow, self).__init__(parent) CommandBase.__init__(self) + + self.logger = logger + + self.gui_app = app + self.desktop_width = app.desktop().screenGeometry().width() + self.desktop_height = app.desktop().screenGeometry().height() + self.options_enabled = False self.output_package_json = True self.setWindowIcon(QtGui.QIcon(os.path.join(CWD, 'files', @@ -773,6 +780,35 @@ class MainWindow(QtGui.QWidget, CommandBase): setting.value = old_val widget.setValue(old_val) + def set_kiosk_emulation_options(self, is_checked): + if is_checked: + width_field = self.find_child_by_name('width') + width_field.setText(str(self.desktop_width)) + + height_field = self.find_child_by_name('height') + height_field.setText(str(self.desktop_height)) + + toolbar_field = self.find_child_by_name('toolbar') + toolbar_field.setChecked(not is_checked) + + frame_field = self.find_child_by_name('frame') + frame_field.setChecked(not is_checked) + + show_field = self.find_child_by_name('show') + show_field.setChecked(is_checked) + + kiosk_field = self.find_child_by_name('kiosk') + kiosk_field.setChecked(not is_checked) + + fullscreen_field = self.find_child_by_name('fullscreen') + fullscreen_field.setChecked(not is_checked) + + always_on_top_field = self.find_child_by_name('always-on-top') + always_on_top_field.setChecked(is_checked) + + resizable_field = self.find_child_by_name('resizable') + resizable_field.setChecked(not is_checked) + def setting_changed(self, obj, setting, *args, **kwargs): if (setting.type == 'string' or setting.type == 'file' or @@ -780,6 +816,9 @@ class MainWindow(QtGui.QWidget, CommandBase): setting.value = obj.text() elif setting.type == 'check': setting.value = obj.isChecked() + check_action = setting.check_action + if hasattr(self, check_action): + getattr(self, check_action)(obj.isChecked()) elif setting.type == 'list': setting.value = obj.currentText() elif setting.type == 'range': @@ -922,7 +961,7 @@ if __name__ == '__main__': QCoreApplication.setOrganizationName("SimplyPixelated") QCoreApplication.setOrganizationDomain("simplypixelated.com") - frame = MainWindow(1000, 500) + frame = MainWindow(1000, 500, app) frame.show_and_raise() sys.exit(app.exec_())