Browse Source

Make sure transport data text is centered

tags/1.9.8
falkTX 7 years ago
parent
commit
95ff85a79a
2 changed files with 21 additions and 5 deletions
  1. +2
    -2
      resources/ui/carla_host.ui
  2. +19
    -3
      source/carla_host.py

+ 2
- 2
resources/ui/carla_host.ui View File

@@ -559,7 +559,7 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>00000000</string>
<string>000'000'000</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -611,7 +611,7 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>000|0|000</string>
<string>000|00|000</string>
</property> </property>
</widget> </widget>
</item> </item>


+ 19
- 3
source/carla_host.py View File

@@ -272,9 +272,25 @@ class HostWindow(QMainWindow):
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
# Set up GUI (transport) # Set up GUI (transport)


self.ui.l_transport_bbt.setMinimumWidth(QFontMetrics(self.ui.l_transport_bbt.font()).width("000|00|0000") + 3)
self.ui.l_transport_frame.setMinimumWidth(QFontMetrics(self.ui.l_transport_frame.font()).width("000'000'000") + 3)
self.ui.l_transport_time.setMinimumWidth(QFontMetrics(self.ui.l_transport_time.font()).width("00:00:00") + 3)
fontMetrics = QFontMetrics(self.ui.l_transport_bbt.font())
minValueWidth = fontMetrics.width("000|00|0000")
minLabelWidth = fontMetrics.width(self.ui.label_transport_frame.text())

labelTimeWidth = fontMetrics.width(self.ui.label_transport_time.text())
labelBBTWidth = fontMetrics.width(self.ui.label_transport_bbt.text())

if minLabelWidth < labelTimeWidth:
minLabelWidth = labelTimeWidth
if minLabelWidth < labelBBTWidth:
minLabelWidth = labelBBTWidth

self.ui.label_transport_frame.setMinimumWidth(minLabelWidth + 3)
self.ui.label_transport_time.setMinimumWidth(minLabelWidth + 3)
self.ui.label_transport_bbt.setMinimumWidth(minLabelWidth + 3)

self.ui.l_transport_bbt.setMinimumWidth(minValueWidth + 3)
self.ui.l_transport_frame.setMinimumWidth(minValueWidth + 3)
self.ui.l_transport_time.setMinimumWidth(minValueWidth + 3)


if host.isPlugin: if host.isPlugin:
self.ui.b_transport_play.setEnabled(False) self.ui.b_transport_play.setEnabled(False)


Loading…
Cancel
Save