Latest `PyQt5` expects `ints` for widget sizings
parent
a2698c73b5
commit
f63a7c497d
|
@ -218,7 +218,7 @@ class Selection(QComboBox):
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
br = _font.boundingRect(str(char))
|
br = _font.boundingRect(str(char))
|
||||||
_, h = br.width(), br.height()
|
_, h = br.width(), int(br.height())
|
||||||
|
|
||||||
# TODO: something better then this monkey patch
|
# TODO: something better then this monkey patch
|
||||||
view = self.view()
|
view = self.view()
|
||||||
|
@ -330,7 +330,7 @@ class FieldsForm(QWidget):
|
||||||
self.form.setSpacing(0)
|
self.form.setSpacing(0)
|
||||||
self.form.setHorizontalSpacing(0)
|
self.form.setHorizontalSpacing(0)
|
||||||
|
|
||||||
self.vbox.addLayout(self.form, stretch=1/3)
|
self.vbox.addLayout(self.form, stretch=3)
|
||||||
|
|
||||||
self.labels: dict[str, QLabel] = {}
|
self.labels: dict[str, QLabel] = {}
|
||||||
self.fields: dict[str, QWidget] = {}
|
self.fields: dict[str, QWidget] = {}
|
||||||
|
@ -557,8 +557,8 @@ class FillStatusBar(QProgressBar):
|
||||||
self.font_size = font_size
|
self.font_size = font_size
|
||||||
|
|
||||||
self.setFormat('') # label format
|
self.setFormat('') # label format
|
||||||
self.setMinimumWidth(width_px)
|
self.setMinimumWidth(int(width_px))
|
||||||
self.setMaximumWidth(width_px)
|
self.setMaximumWidth(int(width_px))
|
||||||
|
|
||||||
def set_slots(
|
def set_slots(
|
||||||
self,
|
self,
|
||||||
|
@ -573,7 +573,7 @@ class FillStatusBar(QProgressBar):
|
||||||
approx_h,
|
approx_h,
|
||||||
slots,
|
slots,
|
||||||
)
|
)
|
||||||
clipped = slots * tot_slot_h + 2*self.border_px
|
clipped = int(slots * tot_slot_h + 2*self.border_px)
|
||||||
self.setMaximumHeight(clipped)
|
self.setMaximumHeight(clipped)
|
||||||
slot_height_px = tot_slot_h - 2*self.slot_margin_px
|
slot_height_px = tot_slot_h - 2*self.slot_margin_px
|
||||||
|
|
||||||
|
@ -657,14 +657,14 @@ def mk_fill_status_bar(
|
||||||
)
|
)
|
||||||
# size according to dpi scaled fonted contents to avoid
|
# size according to dpi scaled fonted contents to avoid
|
||||||
# resizes on magnitude changes (eg. 9 -> 10 %)
|
# resizes on magnitude changes (eg. 9 -> 10 %)
|
||||||
min_w = _font.boundingRect('1000.0M% pnl').width()
|
min_w = int(_font.boundingRect('1000.0M% pnl').width())
|
||||||
left_label.setMinimumWidth(min_w)
|
left_label.setMinimumWidth(min_w)
|
||||||
left_label.resize(
|
left_label.resize(
|
||||||
min_w,
|
min_w,
|
||||||
left_label.size().height(),
|
left_label.size().height(),
|
||||||
)
|
)
|
||||||
|
|
||||||
bar_labels_lhs.addSpacing(5/8 * bar_h)
|
bar_labels_lhs.addSpacing(int(5/8 * bar_h))
|
||||||
|
|
||||||
bar_labels_lhs.addWidget(
|
bar_labels_lhs.addWidget(
|
||||||
left_label,
|
left_label,
|
||||||
|
@ -796,7 +796,7 @@ def mk_order_pane_layout(
|
||||||
form.top_label = top_label
|
form.top_label = top_label
|
||||||
|
|
||||||
# add pp fill bar + spacing
|
# add pp fill bar + spacing
|
||||||
vbox.addLayout(hbox, stretch=1/3)
|
vbox.addLayout(hbox, stretch=3)
|
||||||
|
|
||||||
# TODO: handle resize events and appropriately scale this
|
# TODO: handle resize events and appropriately scale this
|
||||||
# to the sidepane height?
|
# to the sidepane height?
|
||||||
|
|
|
@ -199,7 +199,14 @@ class LevelLabel(YAxisLabel):
|
||||||
elif self._orient_v == 'top':
|
elif self._orient_v == 'top':
|
||||||
lp, rp = rect.bottomLeft(), rect.bottomRight()
|
lp, rp = rect.bottomLeft(), rect.bottomRight()
|
||||||
|
|
||||||
p.drawLine(lp.x(), lp.y(), rp.x(), rp.y())
|
p.drawLine(
|
||||||
|
*map(int, [
|
||||||
|
lp.x(),
|
||||||
|
lp.y(),
|
||||||
|
rp.x(),
|
||||||
|
rp.y(),
|
||||||
|
])
|
||||||
|
)
|
||||||
|
|
||||||
def highlight(self, pen) -> None:
|
def highlight(self, pen) -> None:
|
||||||
self._pen = pen
|
self._pen = pen
|
||||||
|
|
|
@ -671,7 +671,9 @@ async def open_order_mode(
|
||||||
form.fill_bar.height()
|
form.fill_bar.height()
|
||||||
# feed_label.height()
|
# feed_label.height()
|
||||||
)
|
)
|
||||||
vbox.setSpacing((1 + 5/8)*_font.px_size)
|
vbox.setSpacing(
|
||||||
|
int((1 + 5/8)*_font.px_size)
|
||||||
|
)
|
||||||
|
|
||||||
# fill in brokerd feed info
|
# fill in brokerd feed info
|
||||||
host, port = feed.portal.channel.raddr
|
host, port = feed.portal.channel.raddr
|
||||||
|
|
Loading…
Reference in New Issue