Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux compatibility #188

Merged
merged 21 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 56 additions & 4 deletions pylabnet/gui/pyqt/external_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import ctypes

from pylabnet.network.core.client_base import ClientBase
from pylabnet.utils.helper_methods import load_script_config, get_config_filepath
from pylabnet.utils.helper_methods import get_os, load_script_config, get_config_filepath

# Should help with scaling issues on monitors of differing resolution
if hasattr(QtCore.Qt, 'AA_EnableHighDpiScaling'):
Expand Down Expand Up @@ -78,7 +78,8 @@ def __init__(self, app=None, gui_template=None, run=True, host=None, port=None,
self.app = app # Application instance onto which to load the GUI.

if self.app is None:
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('pylabnet')
if get_os() == 'Windows':
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('pylabnet')
self.app = QtWidgets.QApplication(sys.argv)
self.app.setWindowIcon(
QtGui.QIcon(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'devices.ico'))
Expand Down Expand Up @@ -741,8 +742,13 @@ def __init__(self, **params):
self.params[param_name] = QtWidgets.QDoubleSpinBox()
self.params[param_name].setMaximum(100000000)
self.params[param_name].setDecimals(6)
elif param_type is str:
self.params[param_name] = QtWidgets.QLineEdit()
elif type(param_type) is list:
self.params[param_name] = QtWidgets.QComboBox()
self.params[param_name].addItems(param_type)
else:
self.params[param_name] = QtWidgets.QLabel()
self.params[param_name] = QtWidgets.QLabel('None')
layout.addWidget(self.params[param_name])
self.base_layout.addLayout(layout)

Expand All @@ -761,7 +767,10 @@ def return_params(self):
try:
ret[param_name] = widget.value()
except AttributeError:
ret[param_name] = widget.text()
try:
ret[param_name] = widget.currentText()
except AttributeError:
ret[param_name] = widget.text()
self.parameters.emit(ret)
self.close()

Expand Down Expand Up @@ -1204,3 +1213,46 @@ def set_item_index(self, index):
"""

self.widget.setCurrentIndex(index)


def fresh_popup(**params):
""" Creates a fresh ParameterPopup without a base GUI

:param params: kwargs of parameters as keywords and data types
as values
:return: ParameterPopup
"""

app = QtWidgets.QApplication(sys.argv)
app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
operating_system = get_os()
app.setWindowIcon(
QtGui.QIcon(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'devices.ico'))
)
if operating_system == 'Windows':
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('pylabnet')

return app, ParameterPopup(**params)

def warning_popup(message):
""" Creates a warning popup without a base GUI

:param message: (str) message to display
"""

app = QtWidgets.QApplication(sys.argv)
app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
operating_system = get_os()
app.setWindowIcon(
QtGui.QIcon(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'devices.ico'))
)
if operating_system == 'Windows':
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('pylabnet')

QtWidgets.QMessageBox.critical(
None,
"Error",
message,
QtWidgets.QMessageBox.Ok,
QtWidgets.QMessageBox.NoButton
)
22 changes: 0 additions & 22 deletions pylabnet/launchers/AOM_SNSPD_Staticlines.py

This file was deleted.

20 changes: 0 additions & 20 deletions pylabnet/launchers/aom_toptica.py

This file was deleted.

21 changes: 0 additions & 21 deletions pylabnet/launchers/count_histogram.py

This file was deleted.

24 changes: 0 additions & 24 deletions pylabnet/launchers/counters.py

This file was deleted.

23 changes: 0 additions & 23 deletions pylabnet/launchers/data_taker.py

This file was deleted.

34 changes: 0 additions & 34 deletions pylabnet/launchers/fiber_coupling_b16.py

This file was deleted.

19 changes: 0 additions & 19 deletions pylabnet/launchers/fiber_coupling_front.py

This file was deleted.

20 changes: 0 additions & 20 deletions pylabnet/launchers/imaging_laser.py

This file was deleted.

22 changes: 0 additions & 22 deletions pylabnet/launchers/laser_scan.py

This file was deleted.

Loading