def __init__(self, parent, transformation, scaleDivision, logger=None): super(HorizontalScaleWidget, self).__init__() self.titleWidget = HorizontalTitleWidget("Scale Widget Title", self) self.scaleBar = HorizontalScaleBar(self, transformation, scaleDivision) plotLayout = QtWidgets.QGridLayout() plotLayout.setSpacing(0) plotLayout.setContentsMargins(0, 0, 0, 0) plotLayout.addWidget(self.scaleBar, 0, 0) plotLayout.addWidget(self.titleWidget, 1, 0) self.setLayout(plotLayout)
class HorizontalScaleWidget(QtWidgets.QWidget): def __init__(self, parent, transformation, scaleDivision, logger=None): super(HorizontalScaleWidget, self).__init__() self.titleWidget = HorizontalTitleWidget("Scale Widget Title", self) self.scaleBar = HorizontalScaleBar(self, transformation, scaleDivision) plotLayout = QtWidgets.QGridLayout() plotLayout.setSpacing(0) plotLayout.setContentsMargins(0, 0, 0, 0) plotLayout.addWidget(self.scaleBar, 0, 0) plotLayout.addWidget(self.titleWidget, 1, 0) self.setLayout(plotLayout) def setTitle(self, title): self.titleWidget.setTitle(title) def setScaleProperties(self, transformation, scaleDivision): self.scaleBar.set_scale_properties(transformation, scaleDivision) def spacingBorders(self): return self.scaleBar.spacingBorders()