tpds-application 2.2.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tpds/__init__.py +1 -0
- tpds/app/TPDS_Application.py +102 -0
- tpds/app/__init__.py +3 -0
- tpds/app/app.py +135 -0
- tpds/app/assets/Trust Platform.icns +0 -0
- tpds/app/assets/app.ico +0 -0
- tpds/app/assets/icons8-close_window.png +0 -0
- tpds/app/assets/icons8-dev.png +0 -0
- tpds/app/control.py +37 -0
- tpds/app/docks.py +15 -0
- tpds/app/main.py +530 -0
- tpds/app/network.py +28 -0
- tpds/app/processing.py +212 -0
- tpds/app/pyside_check.py +23 -0
- tpds/app/tools.py +216 -0
- tpds/app/ui/__init__.py +3 -0
- tpds/app/ui/packman_form.py +134 -0
- tpds/app/ui/packman_form.ui +141 -0
- tpds/app/ui/packman_ui.py +738 -0
- tpds/app/ui/settings_dialog.py +95 -0
- tpds/app/ui/settings_dialog.ui +144 -0
- tpds/app/ui/settings_ui.py +169 -0
- tpds/app/vars.py +48 -0
- tpds/licenses.txt +23891 -0
- tpds/update/__init__.py +4 -0
- tpds/update/check_updates.py +113 -0
- tpds/worker/__init__.py +1 -0
- tpds/worker/worker.py +74 -0
- tpds_application-2.2.6.dist-info/METADATA +23967 -0
- tpds_application-2.2.6.dist-info/RECORD +33 -0
- tpds_application-2.2.6.dist-info/WHEEL +5 -0
- tpds_application-2.2.6.dist-info/entry_points.txt +2 -0
- tpds_application-2.2.6.dist-info/top_level.txt +1 -0
tpds/app/processing.py
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
"""
|
|
3
|
+
TPDS Qt Based Process Management Utiltities
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import enum
|
|
7
|
+
from typing import Callable, Sequence, Literal, Tuple, Union, Any, List
|
|
8
|
+
from PySide2.QtCore import Slot, QProcess
|
|
9
|
+
|
|
10
|
+
# TPDS Common Resources
|
|
11
|
+
from tpds.helper import LogFacility
|
|
12
|
+
|
|
13
|
+
class ErrorHandling(enum.IntEnum):
|
|
14
|
+
LOG = 1
|
|
15
|
+
CAPTURE = 2
|
|
16
|
+
DISCARD = 3
|
|
17
|
+
|
|
18
|
+
__allowed_handling = Literal[ErrorHandling.DISCARD, ErrorHandling.CAPTURE, ErrorHandling.LOG]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class TpdsProcessTimeout(Exception):
|
|
22
|
+
"""Timeout occured while executing the process """
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class TpdsProcess():
|
|
26
|
+
def __init__(self, parent: Union[Any, None] = None, err_handling: __allowed_handling = ErrorHandling.DISCARD,
|
|
27
|
+
stdout_callback: Callable[[Any], None] = None, stderr_callback: Callable[[Any], None] = None,
|
|
28
|
+
started_callback: Callable[[Any], None] = None) -> None:
|
|
29
|
+
self._process = QProcess(parent)
|
|
30
|
+
self._stdout = stdout_callback
|
|
31
|
+
self._stderr = stderr_callback
|
|
32
|
+
self._started = started_callback
|
|
33
|
+
self._stderr_handling = err_handling
|
|
34
|
+
self._stdout_buffer = ''
|
|
35
|
+
self._stderr_buffer = ''
|
|
36
|
+
self.returncode = 0
|
|
37
|
+
self.pid = 0
|
|
38
|
+
|
|
39
|
+
if err_handling == ErrorHandling.CAPTURE:
|
|
40
|
+
self._process.setProcessChannelMode(QProcess.ProcessChannelMode.MergedChannels)
|
|
41
|
+
|
|
42
|
+
self._process.readyReadStandardOutput.connect(self.__stdout_signal)
|
|
43
|
+
|
|
44
|
+
# QProcess emits `readyReadStandardError` when there is data
|
|
45
|
+
# to be read from stderr
|
|
46
|
+
self._process.readyReadStandardError.connect(self.__stderr_signal)
|
|
47
|
+
|
|
48
|
+
# QProcess emits `started` when process starts
|
|
49
|
+
self._process.started.connect(self.__started_signal)
|
|
50
|
+
|
|
51
|
+
# QProcess emits `finished` when process ends
|
|
52
|
+
self._process.finished.connect(self.__finished_signal)
|
|
53
|
+
|
|
54
|
+
# QProcess emits `errors` when process encounters errors
|
|
55
|
+
self._process.error.connect(self.__error_signal)
|
|
56
|
+
|
|
57
|
+
# QProcess emits state whenever it changes
|
|
58
|
+
self._process.stateChanged.connect(self.__state_signal)
|
|
59
|
+
|
|
60
|
+
def start(self, *args, **kwargs):
|
|
61
|
+
self._process.start(*args, **kwargs)
|
|
62
|
+
self.pid = self._process.pid()
|
|
63
|
+
|
|
64
|
+
def wait(self, timeout: Union[int, None] = None) -> Tuple[str, str]:
|
|
65
|
+
"""
|
|
66
|
+
Wait for the process to complete - will timeout if the timeout value is not None
|
|
67
|
+
"""
|
|
68
|
+
result = self._process.waitForFinished(msecs=timeout * 1000 if timeout else -1)
|
|
69
|
+
error_data = self._stderr_buffer + str(self._process.readAllStandardError(), encoding='utf-8')
|
|
70
|
+
self.returncode = int(self._process.exitCode())
|
|
71
|
+
|
|
72
|
+
if result:
|
|
73
|
+
out_data = self._stdout_buffer + str(self._process.readAllStandardOutput(), encoding='utf-8')
|
|
74
|
+
return out_data, error_data
|
|
75
|
+
else:
|
|
76
|
+
raise TpdsProcessTimeout()
|
|
77
|
+
|
|
78
|
+
def kill(self):
|
|
79
|
+
self._process.kill()
|
|
80
|
+
|
|
81
|
+
@Slot()
|
|
82
|
+
def __stdout_signal(self):
|
|
83
|
+
update = str(self._process.readAllStandardOutput(), encoding='utf-8')
|
|
84
|
+
if self._stdout:
|
|
85
|
+
self._stdout(update)
|
|
86
|
+
self._stdout_buffer += update
|
|
87
|
+
|
|
88
|
+
@Slot()
|
|
89
|
+
def __stderr_signal(self):
|
|
90
|
+
if self._stderr_handling != ErrorHandling.DISCARD:
|
|
91
|
+
update = str(self._process.readAllStandardError(), encoding='utf-8')
|
|
92
|
+
if self._stderr:
|
|
93
|
+
self._stderr(update)
|
|
94
|
+
self._stderr_buffer += update
|
|
95
|
+
|
|
96
|
+
@Slot()
|
|
97
|
+
def __started_signal(self):
|
|
98
|
+
if self._started:
|
|
99
|
+
self._started(self._process)
|
|
100
|
+
|
|
101
|
+
@Slot(QProcess.ProcessState)
|
|
102
|
+
def __state_signal(self, state):
|
|
103
|
+
pass
|
|
104
|
+
|
|
105
|
+
@Slot(int, QProcess.ExitStatus)
|
|
106
|
+
def __finished_signal(self, exitcode, exitstate):
|
|
107
|
+
pass
|
|
108
|
+
|
|
109
|
+
@Slot(QProcess.ProcessError)
|
|
110
|
+
def __error_signal(self, status):
|
|
111
|
+
pass
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class TpdsAppProcessing():
|
|
115
|
+
"""
|
|
116
|
+
Qt based processing utiltities
|
|
117
|
+
"""
|
|
118
|
+
__shared_state: dict[str, Any] = {}
|
|
119
|
+
DISCARD = ErrorHandling.DISCARD
|
|
120
|
+
CAPTURE = ErrorHandling.CAPTURE
|
|
121
|
+
LOG = ErrorHandling.LOG
|
|
122
|
+
|
|
123
|
+
def __new__(cls, *args: Any, **kwargs: Any) -> Any:
|
|
124
|
+
instance = super().__new__(cls)
|
|
125
|
+
instance.__dict__ = cls.__shared_state
|
|
126
|
+
return instance
|
|
127
|
+
|
|
128
|
+
def __init__(self, parent: Any = None) -> None:
|
|
129
|
+
self._processes: List[QProcess] = []
|
|
130
|
+
self._parent = parent
|
|
131
|
+
self._log = LogFacility()
|
|
132
|
+
|
|
133
|
+
def _get_process(self, pid: int) -> Union[QProcess, None]:
|
|
134
|
+
for proc in self._processes:
|
|
135
|
+
if proc.pid() == pid:
|
|
136
|
+
return proc
|
|
137
|
+
return None
|
|
138
|
+
|
|
139
|
+
def start(self, cmd: Sequence[str], err_handling: __allowed_handling = ErrorHandling.DISCARD, \
|
|
140
|
+
log_args: bool = True, **kwargs: Any) -> QProcess:
|
|
141
|
+
"""
|
|
142
|
+
Start an external process
|
|
143
|
+
"""
|
|
144
|
+
process = TpdsProcess(self._parent, err_handling=err_handling, **kwargs)
|
|
145
|
+
|
|
146
|
+
if log_args:
|
|
147
|
+
self._log.log('Started "{}" with pid {}'.format(' '.join(cmd), process.pid))
|
|
148
|
+
else:
|
|
149
|
+
self._log.log('Started "{}" with pid {}'.format(cmd[0], process.pid))
|
|
150
|
+
|
|
151
|
+
# Start process
|
|
152
|
+
process.start(cmd[0], cmd[1:])
|
|
153
|
+
|
|
154
|
+
self._processes += [process]
|
|
155
|
+
return process
|
|
156
|
+
|
|
157
|
+
def wait(self, process: TpdsProcess, timeout: Union[int, None] = None) -> Tuple[str, int]:
|
|
158
|
+
"""
|
|
159
|
+
Wait for the process to complete - will timeout if the timeout value is not None
|
|
160
|
+
"""
|
|
161
|
+
try:
|
|
162
|
+
out_data, error_data = process.wait(timeout=timeout)
|
|
163
|
+
self._log.log('Process ({}) ended with code ({})'.format(process.pid, process.returncode))
|
|
164
|
+
except TpdsProcessTimeout as e:
|
|
165
|
+
process.kill()
|
|
166
|
+
out_data = process._stdout_buffer
|
|
167
|
+
error_data = process._stderr_buffer
|
|
168
|
+
self._log.log('Process ({}) Timed out after running for {}'.format(process.pid, timeout))
|
|
169
|
+
finally:
|
|
170
|
+
returncode = process.returncode
|
|
171
|
+
if error_data:
|
|
172
|
+
self._log.log(error_data)
|
|
173
|
+
if process in self._processes:
|
|
174
|
+
self._processes.remove(process)
|
|
175
|
+
return out_data, returncode
|
|
176
|
+
|
|
177
|
+
def run_cmd(self, cmd: Sequence[str], timeout: Union[int, None]=None,
|
|
178
|
+
err_handling: __allowed_handling = ErrorHandling.DISCARD,
|
|
179
|
+
**kwargs: Any) -> Tuple[str, int]:
|
|
180
|
+
"""
|
|
181
|
+
Generic function to run a command and return the
|
|
182
|
+
"""
|
|
183
|
+
process = self.start(cmd, err_handling=err_handling, **kwargs)
|
|
184
|
+
return self.wait(process, timeout)
|
|
185
|
+
|
|
186
|
+
def kill(self, process: Union[TpdsProcess, int, None]) -> None:
|
|
187
|
+
"""
|
|
188
|
+
Kill a process that was started
|
|
189
|
+
"""
|
|
190
|
+
if isinstance(process, int):
|
|
191
|
+
process = self._get_process(process)
|
|
192
|
+
|
|
193
|
+
if isinstance(process, TpdsProcess):
|
|
194
|
+
process.kill()
|
|
195
|
+
|
|
196
|
+
def terminate_all(self) -> None:
|
|
197
|
+
"""
|
|
198
|
+
Terminate all running process
|
|
199
|
+
"""
|
|
200
|
+
self._log.log('Terminating {} processes'.format(len(self._processes)))
|
|
201
|
+
# Loop through and kill all processes
|
|
202
|
+
for process in self._processes:
|
|
203
|
+
try:
|
|
204
|
+
self.kill(process)
|
|
205
|
+
except Exception as e:
|
|
206
|
+
# Process is probably already dead
|
|
207
|
+
pass
|
|
208
|
+
finally:
|
|
209
|
+
self._processes.remove(process)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
__all__ = ['TpdsAppProcessing', 'ErrorHandling']
|
tpds/app/pyside_check.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
|
|
3
|
+
def pyside2_check():
|
|
4
|
+
# Check if PySide2 and azure packages are installed
|
|
5
|
+
try:
|
|
6
|
+
import PySide2
|
|
7
|
+
except (ModuleNotFoundError, ImportError) as e:
|
|
8
|
+
def run_command(command):
|
|
9
|
+
process = subprocess.Popen(
|
|
10
|
+
command,
|
|
11
|
+
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
|
12
|
+
universal_newlines=True)
|
|
13
|
+
# Poll process.stdout to show stdout live
|
|
14
|
+
while True:
|
|
15
|
+
output = process.stdout.readline()
|
|
16
|
+
if (output == '') and (process.poll() is not None):
|
|
17
|
+
break
|
|
18
|
+
if output:
|
|
19
|
+
print(output.strip())
|
|
20
|
+
rc = process.poll()
|
|
21
|
+
return rc
|
|
22
|
+
# Start pyside2 installation through pip
|
|
23
|
+
run_command(['python', '-m', 'pip', 'install', 'pyside2'])
|
tpds/app/tools.py
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from PySide2.QtWidgets import (
|
|
3
|
+
QStackedWidget, QDockWidget, QPushButton, QWidget, QGridLayout,
|
|
4
|
+
QGroupBox, QVBoxLayout, QButtonGroup, QToolButton)
|
|
5
|
+
from PySide2.QtCore import Qt, QUrl
|
|
6
|
+
from PySide2.QtGui import QIcon
|
|
7
|
+
from collections import OrderedDict
|
|
8
|
+
|
|
9
|
+
from tpds.helper import log
|
|
10
|
+
from .control import shutdown
|
|
11
|
+
from .vars import get_app_ref
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class WebViewStacked(QStackedWidget):
|
|
15
|
+
def __init__(self, parent):
|
|
16
|
+
super(WebViewStacked, self).__init__(parent)
|
|
17
|
+
self.main_window = parent
|
|
18
|
+
|
|
19
|
+
# Tool palette located in the left docking area
|
|
20
|
+
self.tooldock = QDockWidget('Tools', parent)
|
|
21
|
+
self.tooldock.setFeatures(
|
|
22
|
+
QDockWidget.DockWidgetFloatable | QDockWidget.DockWidgetMovable)
|
|
23
|
+
self.main_window.addDockWidget(Qt.LeftDockWidgetArea, self.tooldock)
|
|
24
|
+
|
|
25
|
+
# Top Tools widget
|
|
26
|
+
self.tools = QWidget()
|
|
27
|
+
self.tools_layout = QVBoxLayout()
|
|
28
|
+
self.tools.setLayout(self.tools_layout)
|
|
29
|
+
self.tooldock.setWidget(self.tools) # add the top tools to the dock
|
|
30
|
+
|
|
31
|
+
# Build the grid organizing the child widgets within viewbutton
|
|
32
|
+
self.webviews_widgets = ViewButtons(
|
|
33
|
+
'Webviews', self.main_window, self)
|
|
34
|
+
self.tools_layout.addWidget(self.webviews_widgets)
|
|
35
|
+
|
|
36
|
+
# Create the main widget containing all the notebook view buttons
|
|
37
|
+
self.notebook_widgets = ViewButtons(
|
|
38
|
+
'Usecases', self.main_window, self)
|
|
39
|
+
self.tools_layout.addWidget(self.notebook_widgets)
|
|
40
|
+
self.ordPages = OrderedDict() # To maintain all the wigets
|
|
41
|
+
self.wpage = list() # webpages widgets
|
|
42
|
+
self.npage = list() # notebook widgets
|
|
43
|
+
|
|
44
|
+
def addWebView(self, title, webview, notebook=False):
|
|
45
|
+
self.addWidget(webview) # get the webview tab index
|
|
46
|
+
|
|
47
|
+
# Add the control widgets to the tool palette.
|
|
48
|
+
self.ordPages.update({webview: notebook})
|
|
49
|
+
|
|
50
|
+
if notebook:
|
|
51
|
+
self.npage.append(webview)
|
|
52
|
+
dev_mode = True if get_app_ref().backend._config.settings.develop else False
|
|
53
|
+
self.notebook_widgets.add_view_controls(
|
|
54
|
+
title, self.npage.index(webview),
|
|
55
|
+
develop=dev_mode, new_target=False,
|
|
56
|
+
nb=notebook)
|
|
57
|
+
self.notebook_widgets.check_button(self.npage.index(webview))
|
|
58
|
+
else:
|
|
59
|
+
self.wpage.append(webview)
|
|
60
|
+
self.webviews_widgets.add_view_controls(
|
|
61
|
+
title, self.wpage.index(webview))
|
|
62
|
+
self.activateWebView(self.wpage.index(webview), False)
|
|
63
|
+
|
|
64
|
+
def updateView(self, title, index, notebook):
|
|
65
|
+
updated_index = index
|
|
66
|
+
if notebook:
|
|
67
|
+
self.notebook_widgets.update_view_controls(title, updated_index)
|
|
68
|
+
else:
|
|
69
|
+
self.webviews_widgets.update_view_controls(title, updated_index)
|
|
70
|
+
|
|
71
|
+
def removeWebView(self, index, notebook=None):
|
|
72
|
+
if notebook:
|
|
73
|
+
webview = self.npage[index]
|
|
74
|
+
resp = self.ordPages.pop(webview, None)
|
|
75
|
+
self.npage.remove(webview)
|
|
76
|
+
if resp is not None:
|
|
77
|
+
self.notebook_widgets.remove_view_controls(index)
|
|
78
|
+
webview.deleteLater()
|
|
79
|
+
elif index > 0 and index < len(self.wpage):
|
|
80
|
+
webview = self.wpage[index]
|
|
81
|
+
resp = self.ordPages.pop(webview, None)
|
|
82
|
+
self.wpage.remove(webview)
|
|
83
|
+
if resp is not None:
|
|
84
|
+
self.webviews_widgets.remove_view_controls(index)
|
|
85
|
+
webview.deleteLater()
|
|
86
|
+
elif len(self.wpage) == 0:
|
|
87
|
+
shutdown()
|
|
88
|
+
|
|
89
|
+
def activateWebView(self, index, notebook):
|
|
90
|
+
if notebook:
|
|
91
|
+
resp = self.npage[index]
|
|
92
|
+
self.notebook_widgets.check_button(index)
|
|
93
|
+
else:
|
|
94
|
+
resp = self.wpage[index]
|
|
95
|
+
self.webviews_widgets.check_button(index)
|
|
96
|
+
self.setCurrentWidget(resp)
|
|
97
|
+
|
|
98
|
+
def windows(self):
|
|
99
|
+
return len(self.pages)
|
|
100
|
+
|
|
101
|
+
def changeDevelopView(self, index, nb):
|
|
102
|
+
# This is applicable only for Notebooks
|
|
103
|
+
if get_app_ref().backend._config.settings.develop:
|
|
104
|
+
nb.setText('Loading...')
|
|
105
|
+
webview = self.npage[index]
|
|
106
|
+
nb_url = webview.url().toString()
|
|
107
|
+
log(f'{nb_url}')
|
|
108
|
+
for jupyter_inst in get_app_ref().backend._voila:
|
|
109
|
+
if jupyter_inst._web_address in nb_url:
|
|
110
|
+
if 'voila/render' in nb_url:
|
|
111
|
+
nb_path = "/".join(nb_url.strip("/").split('/')[5:])
|
|
112
|
+
nb_url = (
|
|
113
|
+
f'{jupyter_inst._web_address}'
|
|
114
|
+
f'notebooks/{nb_path}'
|
|
115
|
+
)
|
|
116
|
+
else:
|
|
117
|
+
nb_path = "/".join(nb_url.strip("/").split('/')[4:])
|
|
118
|
+
nb_url = (
|
|
119
|
+
f'{jupyter_inst._web_address}'
|
|
120
|
+
f'voila/render/{nb_path}'
|
|
121
|
+
)
|
|
122
|
+
webview.page().setUrl(QUrl(nb_url))
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class ViewButtons(QGroupBox):
|
|
126
|
+
def __init__(self, title, parent, stacked_widget):
|
|
127
|
+
super(ViewButtons, self).__init__(title, parent)
|
|
128
|
+
self.stacked_widget = stacked_widget
|
|
129
|
+
self.grid = QGridLayout(self)
|
|
130
|
+
self.grid.setColumnMinimumWidth(1, 1)
|
|
131
|
+
self.setCheckable(False)
|
|
132
|
+
self.gb = QButtonGroup(self)
|
|
133
|
+
self.controls = dict()
|
|
134
|
+
self.tabControl = list()
|
|
135
|
+
|
|
136
|
+
def update_view_controls(self, title, index):
|
|
137
|
+
resp = self.tabControl[index]
|
|
138
|
+
if resp is not None:
|
|
139
|
+
(btn, quit_btn, dev_btn) = resp
|
|
140
|
+
btn.setText(title[0:40])
|
|
141
|
+
log(title)
|
|
142
|
+
btn.setToolTip(title)
|
|
143
|
+
|
|
144
|
+
def add_view_controls(
|
|
145
|
+
self, title, index, develop=False,
|
|
146
|
+
new_target=True, nb=False):
|
|
147
|
+
row = len(self.tabControl)
|
|
148
|
+
while self.grid.itemAtPosition(row, 0) is not None:
|
|
149
|
+
row += 1
|
|
150
|
+
new_quit_btn = QToolButton()
|
|
151
|
+
close_path = os.path.join(os.path.dirname(__file__),
|
|
152
|
+
'assets', 'icons8-close_window.png')
|
|
153
|
+
develop_btn = None
|
|
154
|
+
if develop:
|
|
155
|
+
develop_path = os.path.join(os.path.dirname(__file__),
|
|
156
|
+
'assets', 'icons8-dev.png')
|
|
157
|
+
develop_btn = QToolButton()
|
|
158
|
+
develop_btn.setCheckable(True)
|
|
159
|
+
develop_btn.setChecked(True)
|
|
160
|
+
develop_btn.setIcon(QIcon(develop_path))
|
|
161
|
+
develop_btn.setToolTip('Toggle View')
|
|
162
|
+
self.grid.addWidget(develop_btn, row, 2)
|
|
163
|
+
new_quit_btn.setIcon(QIcon(close_path))
|
|
164
|
+
new_quit_btn.setToolTip('Close View')
|
|
165
|
+
new_btn = QPushButton(title)
|
|
166
|
+
new_btn.setCheckable(True)
|
|
167
|
+
new_btn.setStyleSheet("QPushButton { text-align: left; }")
|
|
168
|
+
new_btn.setText('Loading...')
|
|
169
|
+
if(new_target):
|
|
170
|
+
new_btn.setChecked(True)
|
|
171
|
+
self.gb.addButton(new_btn)
|
|
172
|
+
self.grid.addWidget(new_quit_btn, row, 0)
|
|
173
|
+
self.grid.addWidget(new_btn, row, 1, 1, 1, Qt.AlignLeft)
|
|
174
|
+
self.grid.setRowStretch(row, 0)
|
|
175
|
+
self.grid.setRowStretch(row+1, 2)
|
|
176
|
+
new_entry = [new_btn, new_quit_btn, develop_btn]
|
|
177
|
+
self.tabControl.append([new_btn, new_quit_btn, develop_btn])
|
|
178
|
+
new_btn.clicked.connect(
|
|
179
|
+
lambda: self.stacked_widget.activateWebView(
|
|
180
|
+
self.tabControl.index(new_entry), nb))
|
|
181
|
+
new_quit_btn.clicked.connect(
|
|
182
|
+
lambda: self.stacked_widget.removeWebView(
|
|
183
|
+
self.tabControl.index(new_entry), nb))
|
|
184
|
+
if develop:
|
|
185
|
+
develop_btn.clicked.connect(
|
|
186
|
+
lambda: self.stacked_widget.changeDevelopView(
|
|
187
|
+
self.tabControl.index(new_entry), new_btn)
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
def remove_view_controls(self, index):
|
|
191
|
+
resp1 = self.tabControl[index]
|
|
192
|
+
self.tabControl.pop(index)
|
|
193
|
+
if resp1 is not None:
|
|
194
|
+
(btn_to_remove, quit_btn_to_remove, develop_btn) = resp1
|
|
195
|
+
self.grid.removeWidget(btn_to_remove)
|
|
196
|
+
self.grid.removeWidget(quit_btn_to_remove)
|
|
197
|
+
self.grid.removeWidget(develop_btn)
|
|
198
|
+
self.grid.setRowStretch(index, 0)
|
|
199
|
+
self.gb.removeButton(btn_to_remove)
|
|
200
|
+
btn_to_remove.deleteLater()
|
|
201
|
+
quit_btn_to_remove.deleteLater()
|
|
202
|
+
if develop_btn:
|
|
203
|
+
develop_btn.deleteLater()
|
|
204
|
+
try:
|
|
205
|
+
active_btn = self.tabControl[
|
|
206
|
+
self.stacked_widget.currentIndex()]
|
|
207
|
+
active_btn.click()
|
|
208
|
+
btn_to_remove.disconnect()
|
|
209
|
+
quit_btn_to_remove.disconnect()
|
|
210
|
+
except Exception:
|
|
211
|
+
# will complain with the button was not connected
|
|
212
|
+
pass # Just ignore it
|
|
213
|
+
|
|
214
|
+
def check_button(self, index):
|
|
215
|
+
(new_btn, new_quit_btn, develop_btn) = self.tabControl[index]
|
|
216
|
+
new_btn.setChecked(True)
|
tpds/app/ui/__init__.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
################################################################################
|
|
4
|
+
## Form generated from reading UI file 'packman_form.ui'
|
|
5
|
+
##
|
|
6
|
+
## Created by: Qt User Interface Compiler version 5.15.2
|
|
7
|
+
##
|
|
8
|
+
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
|
9
|
+
################################################################################
|
|
10
|
+
|
|
11
|
+
from PySide2.QtCore import *
|
|
12
|
+
from PySide2.QtGui import *
|
|
13
|
+
from PySide2.QtWidgets import *
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Ui_Form(object):
|
|
17
|
+
def setupUi(self, Form):
|
|
18
|
+
if not Form.objectName():
|
|
19
|
+
Form.setObjectName(u"Form")
|
|
20
|
+
Form.resize(701, 499)
|
|
21
|
+
self.gridLayout_3 = QGridLayout(Form)
|
|
22
|
+
self.gridLayout_3.setObjectName(u"gridLayout_3")
|
|
23
|
+
self.frame = QFrame(Form)
|
|
24
|
+
self.frame.setObjectName(u"frame")
|
|
25
|
+
self.frame.setFrameShape(QFrame.StyledPanel)
|
|
26
|
+
self.frame.setFrameShadow(QFrame.Raised)
|
|
27
|
+
self.gridLayout_2 = QGridLayout(self.frame)
|
|
28
|
+
self.gridLayout_2.setObjectName(u"gridLayout_2")
|
|
29
|
+
self.verticalLayout = QVBoxLayout()
|
|
30
|
+
self.verticalLayout.setObjectName(u"verticalLayout")
|
|
31
|
+
self.horizontalLayout = QHBoxLayout()
|
|
32
|
+
self.horizontalLayout.setObjectName(u"horizontalLayout")
|
|
33
|
+
self.refresh_button = QPushButton(self.frame)
|
|
34
|
+
self.refresh_button.setObjectName(u"refresh_button")
|
|
35
|
+
self.horizontalLayout.addWidget(self.refresh_button)
|
|
36
|
+
|
|
37
|
+
self.install_extn_button = QPushButton(self.frame)
|
|
38
|
+
self.install_extn_button.setObjectName(u"install_extn_button")
|
|
39
|
+
self.horizontalLayout.addWidget(self.install_extn_button)
|
|
40
|
+
|
|
41
|
+
self.horizontalSpacer = QSpacerItem(268, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
42
|
+
|
|
43
|
+
self.horizontalLayout.addItem(self.horizontalSpacer)
|
|
44
|
+
|
|
45
|
+
self.login_info = QLabel(self.frame)
|
|
46
|
+
self.login_info.setObjectName(u"login_info")
|
|
47
|
+
self.login_info.setMinimumSize(QSize(180, 0))
|
|
48
|
+
self.login_info.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
|
|
49
|
+
|
|
50
|
+
self.horizontalLayout.addWidget(self.login_info)
|
|
51
|
+
|
|
52
|
+
self.login_button = QPushButton(self.frame)
|
|
53
|
+
self.login_button.setObjectName(u"login_button")
|
|
54
|
+
|
|
55
|
+
self.horizontalLayout.addWidget(self.login_button)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
self.verticalLayout.addLayout(self.horizontalLayout)
|
|
59
|
+
|
|
60
|
+
self.tabWidget = QTabWidget(self.frame)
|
|
61
|
+
self.tabWidget.setObjectName(u"tabWidget")
|
|
62
|
+
self.tabWidget.setMinimumSize(QSize(650, 400))
|
|
63
|
+
self.tab = QWidget()
|
|
64
|
+
self.tab.setObjectName(u"tab")
|
|
65
|
+
self.gridLayout = QGridLayout(self.tab)
|
|
66
|
+
self.gridLayout.setObjectName(u"gridLayout")
|
|
67
|
+
self.verticalLayout_2 = QVBoxLayout()
|
|
68
|
+
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
|
|
69
|
+
self.installed_pkgs_table = QTableView(self.tab)
|
|
70
|
+
self.installed_pkgs_table.setObjectName(u"installed_pkgs_table")
|
|
71
|
+
|
|
72
|
+
self.verticalLayout_2.addWidget(self.installed_pkgs_table)
|
|
73
|
+
|
|
74
|
+
self.horizontalLayout_2 = QHBoxLayout()
|
|
75
|
+
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
|
|
76
|
+
|
|
77
|
+
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
self.gridLayout.addLayout(self.verticalLayout_2, 0, 0, 1, 1)
|
|
81
|
+
|
|
82
|
+
self.tabWidget.addTab(self.tab, "")
|
|
83
|
+
self.tab_2 = QWidget()
|
|
84
|
+
self.tab_2.setObjectName(u"tab_2")
|
|
85
|
+
self.gridLayout_4 = QGridLayout(self.tab_2)
|
|
86
|
+
self.gridLayout_4.setObjectName(u"gridLayout_4")
|
|
87
|
+
self.verticalLayout_3 = QVBoxLayout()
|
|
88
|
+
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
|
|
89
|
+
self.tpds_packages_table = QTableView(self.tab_2)
|
|
90
|
+
self.tpds_packages_table.setObjectName(u"tpds_packages_table")
|
|
91
|
+
|
|
92
|
+
self.verticalLayout_3.addWidget(self.tpds_packages_table)
|
|
93
|
+
|
|
94
|
+
self.horizontalLayout_3 = QHBoxLayout()
|
|
95
|
+
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
|
|
96
|
+
|
|
97
|
+
self.verticalLayout_3.addLayout(self.horizontalLayout_3)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
self.gridLayout_4.addLayout(self.verticalLayout_3, 0, 0, 1, 1)
|
|
101
|
+
|
|
102
|
+
self.tabWidget.addTab(self.tab_2, "")
|
|
103
|
+
|
|
104
|
+
self.verticalLayout.addWidget(self.tabWidget)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
self.gridLayout_2.addLayout(self.verticalLayout, 0, 0, 1, 1)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
self.gridLayout_3.addWidget(self.frame, 0, 0, 1, 1)
|
|
111
|
+
|
|
112
|
+
self.statusbar = QStatusBar(Form)
|
|
113
|
+
self.statusbar.setObjectName(u"statusbar")
|
|
114
|
+
|
|
115
|
+
self.gridLayout_3.addWidget(self.statusbar, 1, 0, 1, 1)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
self.retranslateUi(Form)
|
|
119
|
+
|
|
120
|
+
self.tabWidget.setCurrentIndex(1)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
QMetaObject.connectSlotsByName(Form)
|
|
124
|
+
# setupUi
|
|
125
|
+
|
|
126
|
+
def retranslateUi(self, Form):
|
|
127
|
+
Form.setWindowTitle(QCoreApplication.translate("Form", u"Package Manager", None))
|
|
128
|
+
self.refresh_button.setText(QCoreApplication.translate("Form", u"Refresh", None))
|
|
129
|
+
self.login_info.setText(QCoreApplication.translate("Form", u"", None))
|
|
130
|
+
self.login_button.setText(QCoreApplication.translate("Form", u"Login", None))
|
|
131
|
+
self.install_extn_button.setText(QCoreApplication.translate("Form", u"Install TPDS Extension", None))
|
|
132
|
+
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("Form", u"Installed Packages", None))
|
|
133
|
+
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("Form", u"TPDS Packages", None))
|
|
134
|
+
# retranslateUi
|