Skip to content

Commit

Permalink
Merge pull request #595 from ZLLentz/maint_cli_defaults
Browse files Browse the repository at this point in the history
MAINT: switch typhos cli defaults to embedded/vertical by popular demand
  • Loading branch information
ZLLentz authored Dec 5, 2023
2 parents 4ad54e7 + 3aaf16c commit d1c41f4
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
25 changes: 25 additions & 0 deletions docs/source/upcoming_release_notes/595-maint_cli_defaults.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
595 maint_cli_defaults
######################

API Breaks
----------
- Default typhos suites to "embedded" displays arranged "vertically" instead of
"detailed" displays arranged "horizontally" to more naturally match how typhos is
used at present.

Features
--------
- N/A


Bugfixes
--------
- N/A

Maintenance
-----------
- N/A

Contributors
------------
- zllentz
12 changes: 6 additions & 6 deletions typhos/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ class TyphosArguments(types.SimpleNamespace):
)
parser.add_argument(
'--layout',
default='horizontal',
default='vertical',
help=(
'Select a alternate layout for suites of many '
'devices. Valid options are "horizontal" (default), '
'"vertical", "grid", "flow", and any unique '
'devices. Valid options are "horizontal", '
'"vertical" (default), "grid", "flow", and any unique '
'shortenings of those options.'
),
)
Expand All @@ -89,11 +89,11 @@ class TyphosArguments(types.SimpleNamespace):
)
parser.add_argument(
'--display-type',
default='detailed',
default='embedded',
help=(
'The kind of display to open for each device at '
'initial load. Valid options are "embedded", '
'"detailed" (default), "engineering", and any '
'initial load. Valid options are "embedded" (default), '
'"detailed", "engineering", and any '
'unique shortenings of those options.'
),
)
Expand Down
14 changes: 8 additions & 6 deletions typhos/tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

import pytest
from qtpy.QtWidgets import QLabel

import typhos
from typhos.cli import typhos_cli
Expand Down Expand Up @@ -33,19 +34,20 @@ def test_cli_no_entry(qtbot, happi_cfg):

def test_cli_stylesheet(qapp, qtbot, happi_cfg):
with open('test.qss', 'w+') as handle:
handle.write(
"TyphosDeviceDisplay {qproperty-force_template: 'test.ui'}")
handle.write("QLabel {color: red}")
try:
style = qapp.styleSheet()
window = typhos_cli(['test_motor', '--stylesheet', 'test.qss',
'--happi-cfg', happi_cfg])
qtbot.addWidget(window)
suite = window.centralWidget()
dev_display = suite.get_subdisplay(suite.devices[0])
assert dev_display.force_template == 'test.ui'
qtbot.add_widget(dev_display)
qapp.setStyleSheet(style)
qtbot.addWidget(suite)
some_label = suite.findChild(QLabel)
assert isinstance(some_label, QLabel)
color = some_label.palette().color(some_label.foregroundRole())
assert color.red() == 255
finally:
qapp.setStyleSheet(style)
os.remove('test.qss')


Expand Down

0 comments on commit d1c41f4

Please sign in to comment.