mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-13 11:11:49 +02:00
feat(scan_progressbar): added oneline design for compact applications
This commit is contained in:
@ -123,11 +123,14 @@ class ScanProgressBar(BECWidget, QWidget):
|
|||||||
|
|
||||||
ICON_NAME = "timelapse"
|
ICON_NAME = "timelapse"
|
||||||
|
|
||||||
def __init__(self, parent=None, client=None, config=None, gui_id=None):
|
def __init__(self, parent=None, client=None, config=None, gui_id=None, one_line_design=False):
|
||||||
super().__init__(parent=parent, client=client, config=config, gui_id=gui_id)
|
super().__init__(parent=parent, client=client, config=config, gui_id=gui_id)
|
||||||
|
|
||||||
self.get_bec_shortcuts()
|
self.get_bec_shortcuts()
|
||||||
ui_file = os.path.join(os.path.dirname(__file__), "scan_progressbar.ui")
|
ui_file = os.path.join(
|
||||||
|
os.path.dirname(__file__),
|
||||||
|
"scan_progressbar_one_line.ui" if one_line_design else "scan_progressbar.ui",
|
||||||
|
)
|
||||||
self.ui = UILoader(self).loader(ui_file)
|
self.ui = UILoader(self).loader(ui_file)
|
||||||
self.layout = QVBoxLayout(self)
|
self.layout = QVBoxLayout(self)
|
||||||
self.layout.setSpacing(0)
|
self.layout.setSpacing(0)
|
||||||
@ -209,6 +212,8 @@ class ScanProgressBar(BECWidget, QWidget):
|
|||||||
@show_elapsed_time.setter
|
@show_elapsed_time.setter
|
||||||
def show_elapsed_time(self, value):
|
def show_elapsed_time(self, value):
|
||||||
self.ui.elapsed_time_label.setVisible(value)
|
self.ui.elapsed_time_label.setVisible(value)
|
||||||
|
if hasattr(self.ui, "dash"):
|
||||||
|
self.ui.dash.setVisible(value)
|
||||||
|
|
||||||
@SafeProperty(bool)
|
@SafeProperty(bool)
|
||||||
def show_remaining_time(self):
|
def show_remaining_time(self):
|
||||||
@ -217,6 +222,8 @@ class ScanProgressBar(BECWidget, QWidget):
|
|||||||
@show_remaining_time.setter
|
@show_remaining_time.setter
|
||||||
def show_remaining_time(self, value):
|
def show_remaining_time(self, value):
|
||||||
self.ui.remaining_time_label.setVisible(value)
|
self.ui.remaining_time_label.setVisible(value)
|
||||||
|
if hasattr(self.ui, "dash"):
|
||||||
|
self.ui.dash.setVisible(value)
|
||||||
|
|
||||||
@SafeProperty(bool)
|
@SafeProperty(bool)
|
||||||
def show_source_label(self):
|
def show_source_label(self):
|
||||||
|
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Form</class>
|
||||||
|
<widget class="QWidget" name="Form">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>328</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1,0">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="source_label">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Scan</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="BECProgressBar" name="progressbar">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="padding_left_right" stdset="0">
|
||||||
|
<double>5.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="remaining_time_label">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0:00:00</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="dash">
|
||||||
|
<property name="text">
|
||||||
|
<string>-</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="elapsed_time_label">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0:00:00</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>BECProgressBar</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>bec_progress_bar</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Reference in New Issue
Block a user