Ejemplo n.º 1
0
class YCrossSection(XCrossSection):
    """
    Y-axis cross section widget
    parent (QWidget): parent widget
    position (string): "left" or "right"
    """
    PANEL_ID = ID_YCS
    OTHER_PANEL_ID = ID_XCS
    CrossSectionPlotKlass = YCrossSectionPlot
    def __init__(self, parent=None, position="right", xsection_pos="top"):
        self.xsection_pos = xsection_pos
        self.spacer = QSpacerItem(0, 0)
        super(YCrossSection, self).__init__(parent)
        self.cs_plot.set_axis_direction("bottom", reverse=position == "left")
        
    def setup_widget(self):
        toolbar = self.toolbar
        toolbar.setOrientation(Qt.Horizontal)
        layout = QVBoxLayout()
        if self.xsection_pos == "top":
            layout.addSpacerItem(self.spacer)
        layout.addWidget(toolbar)
        layout.addWidget(self.cs_plot)
        if self.xsection_pos == "bottom":
            layout.addSpacerItem(self.spacer)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)
        
    def adjust_height(self, height):
        self.spacer.changeSize(0, height, QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.layout().invalidate()
Ejemplo n.º 2
0
class YCrossSection(XCrossSection):
    """
    Y-axis cross section widget
    parent (QWidget): parent widget
    position (string): "left" or "right"
    """
    PANEL_ID = ID_YCS
    OTHER_PANEL_ID = ID_XCS
    CrossSectionPlotKlass = YCrossSectionPlot

    def __init__(self, parent=None, position="right", xsection_pos="top"):
        self.xsection_pos = xsection_pos
        self.spacer = QSpacerItem(0, 0)
        super(YCrossSection, self).__init__(parent)
        self.cs_plot.set_axis_direction("bottom", reverse=position == "left")

    def setup_widget(self):
        toolbar = self.toolbar
        toolbar.setOrientation(Qt.Horizontal)
        layout = QVBoxLayout()
        if self.xsection_pos == "top":
            layout.addSpacerItem(self.spacer)
        layout.addWidget(toolbar)
        layout.addWidget(self.cs_plot)
        if self.xsection_pos == "bottom":
            layout.addSpacerItem(self.spacer)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

    def adjust_height(self, height):
        self.spacer.changeSize(0, height, QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.layout().invalidate()
Ejemplo n.º 3
0
 def add_row(self, widget):
     """Add widget to row"""
     item = widget.item
     line, col, span = self.items_pos[item.item]
     if col > 0:
         self.layout.addItem( QSpacerItem(20, 1), line, col*3-1 )
         
     widget.place_on_grid( self.layout, line, col*3, col*3 + 1, 1, 3*span-2)
     try:
         widget.get()
     except Exception:
         print("Error building item :", item.item._name)
         raise
Ejemplo n.º 4
0
 def __init__(self, parent=None, position="right", xsection_pos="top"):
     self.xsection_pos = xsection_pos
     self.spacer = QSpacerItem(0, 0)
     super(YCrossSection, self).__init__(parent)
     self.cs_plot.set_axis_direction("bottom", reverse=position == "left")
Ejemplo n.º 5
0
 def __init__(self, parent=None, position="right", xsection_pos="top"):
     self.xsection_pos = xsection_pos
     self.spacer = QSpacerItem(0, 0)
     super(YCrossSection, self).__init__(parent)
     self.cs_plot.set_axis_direction("bottom", reverse=position == "left")