示例#1
0
 def __init__(self, parent, x, y, func):
     QWidget.__init__(self, parent)
     self.setMinimumSize(320, 200)
     self.x = x
     self.y = y
     self.func = func
     #---plotpy curve item attribute:
     self.curve_item = None
示例#2
0
 def __init__(self, manager, parent=None, **kwargs):
     super(SubplotWidget, self).__init__(parent, **kwargs)
     self.setOrientation(Qt.Horizontal)
     self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
     self.manager = manager
     self.plots = []
     self.itemlist = None
     main = QWidget()
     self.plotlayout = QGridLayout()
     main.setLayout(self.plotlayout)
     self.addWidget(main)
示例#3
0
 def __init__(self, manager, parent=None, **kwargs):
     super(SubplotWidget, self).__init__(parent, **kwargs)
     self.setOrientation(Qt.Horizontal)
     self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
     self.manager = manager
     self.plots = []
     self.itemlist = None
     main = QWidget()
     self.plotlayout = QGridLayout()
     main.setLayout(self.plotlayout)
     self.addWidget(main)
示例#4
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowTitle("Signal filtering 2 (plotpy)")
        self.setWindowIcon(get_icon('plotpy.svg'))

        hlayout = QHBoxLayout()
        central_widget = QWidget(self)
        central_widget.setLayout(hlayout)
        self.setCentralWidget(central_widget)
        #---plotpy plot manager
        self.manager = PlotManager(self)
示例#5
0
 def __init__(self):
     QMainWindow.__init__(self)
     self.setWindowTitle("Signal filtering 2 (plotpy)")
     self.setWindowIcon(get_icon('plotpy.svg'))
     
     hlayout = QHBoxLayout()
     central_widget = QWidget(self)
     central_widget.setLayout(hlayout)
     self.setCentralWidget(central_widget)
     #---plotpy plot manager
     self.manager = PlotManager(self)
示例#6
0
def get_std_icon(name, size=None):
    """
    Get standard platform icon
    Call 'show_std_icons()' for details
    """
    if not name.startswith('SP_'):
        name = 'SP_'+name
    icon = QWidget().style().standardIcon( getattr(QStyle, name) )
    if size is None:
        return icon
    else:
        return QIcon( icon.pixmap(size, size) )
示例#7
0
def get_std_icon(name, size=None):
    """
    Get standard platform icon
    Call 'show_std_icons()' for details
    """
    if not name.startswith('SP_'):
        name = 'SP_' + name
    icon = QWidget().style().standardIcon(getattr(QStyle, name))
    if size is None:
        return icon
    else:
        return QIcon(icon.pixmap(size, size))
示例#8
0
 def __init__(self,
              wintitle=None,
              icon="plotpy.svg",
              toolbar=False,
              options=None,
              parent=None,
              panels=None,
              param_cols=1,
              legend_anchor='TR',
              auto_fit=False):
     QWidget.__init__(self, parent)
     FitWidgetMixin.__init__(self, wintitle, icon, toolbar, options, panels,
                             param_cols, legend_anchor, auto_fit)
示例#9
0
    def __init__(self, parent, options=None):
        QWidget.__init__(self, parent=parent)

        if options is None:
            options = {}
        self.imagewidget = ImageWidget(self, **options)
        self.imagewidget.register_all_image_tools()

        hlayout = QHBoxLayout()
        self.add_buttons_to_layout(hlayout)

        vlayout = QVBoxLayout()
        vlayout.addWidget(self.imagewidget)
        vlayout.addLayout(hlayout)
        self.setLayout(vlayout)
示例#10
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        font = QFont(get_family(MONOSPACE), 10, QFont.Normal)

        info_icon = QLabel()
        icon = get_std_icon('MessageBoxInformation').pixmap(24, 24)
        info_icon.setPixmap(icon)
        info_icon.setFixedWidth(32)
        info_icon.setAlignment(Qt.AlignTop)
        self.desc_label = QLabel()
        self.desc_label.setWordWrap(True)
        self.desc_label.setAlignment(Qt.AlignTop)
        self.desc_label.setFont(font)
        group_desc = QGroupBox(_("Description"), self)
        layout = QHBoxLayout()
        layout.addWidget(info_icon)
        layout.addWidget(self.desc_label)
        group_desc.setLayout(layout)

        if CodeEditor is None:
            self.editor = QTextEdit(self)
            self.editor.setFont(font)
        else:
            self.editor = CodeEditor(self)
            self.editor.setup_editor(linenumbers=True, font=font)
            self.editor.set_color_scheme("Spyder")
        self.editor.setReadOnly(True)
        group_code = QGroupBox(_("Source code"), self)
        layout = QVBoxLayout()
        layout.addWidget(self.editor)
        group_code.setLayout(layout)

        self.run_button = QPushButton(get_icon("apply.png"),
                                      _("Run this script"), self)
        self.quit_button = QPushButton(get_icon("exit.png"), _("Quit"), self)
        hlayout = QHBoxLayout()
        hlayout.addWidget(self.run_button)
        hlayout.addStretch()
        hlayout.addWidget(self.quit_button)

        vlayout = QVBoxLayout()
        vlayout.addWidget(group_desc)
        vlayout.addWidget(group_code)
        vlayout.addLayout(hlayout)
        self.setLayout(vlayout)
示例#11
0
 def __init__(self, parent):
     QWidget.__init__(self, parent)
     font = QFont(get_family(MONOSPACE), 10, QFont.Normal)
     
     info_icon = QLabel()
     icon = get_std_icon('MessageBoxInformation').pixmap(24, 24)
     info_icon.setPixmap(icon)
     info_icon.setFixedWidth(32)
     info_icon.setAlignment(Qt.AlignTop)
     self.desc_label = QLabel()
     self.desc_label.setWordWrap(True)
     self.desc_label.setAlignment(Qt.AlignTop)
     self.desc_label.setFont(font)
     group_desc = QGroupBox(_("Description"), self)
     layout = QHBoxLayout()
     layout.addWidget(info_icon)
     layout.addWidget(self.desc_label)
     group_desc.setLayout(layout)
     
     if CodeEditor is None:
         self.editor = QTextEdit(self)
         self.editor.setFont(font)
     else:
         self.editor = CodeEditor(self)
         self.editor.setup_editor(linenumbers=True, font=font)
         self.editor.set_color_scheme("Spyder")
     self.editor.setReadOnly(True)
     group_code = QGroupBox(_("Source code"), self)
     layout = QVBoxLayout()
     layout.addWidget(self.editor)
     group_code.setLayout(layout)
     
     self.run_button = QPushButton(get_icon("apply.png"),
                                   _("Run this script"), self)
     self.quit_button = QPushButton(get_icon("exit.png"), _("Quit"), self)
     hlayout = QHBoxLayout()
     hlayout.addWidget(self.run_button)
     hlayout.addStretch()
     hlayout.addWidget(self.quit_button)
     
     vlayout = QVBoxLayout()
     vlayout.addWidget(group_desc)
     vlayout.addWidget(group_code)
     vlayout.addLayout(hlayout)
     self.setLayout(vlayout)
示例#12
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        layout = QGridLayout()
        self.setLayout(layout)

        self.plot1 = ImagePlot(self)
        layout.addWidget(self.plot1, 0, 0, 1, 1)
        self.plot2 = ImagePlot(self)
        layout.addWidget(self.plot2, 1, 0, 1, 1)

        self.contrast = ContrastAdjustment(self)
        layout.addWidget(self.contrast, 2, 0, 1, 2)
        self.itemlist = PlotItemList(self)
        layout.addWidget(self.itemlist, 0, 1, 2, 1)

        self.manager = PlotManager(self)
        for plot in (self.plot1, self.plot2):
            self.manager.add_plot(plot)
        for panel in (self.itemlist, self.contrast):
            self.manager.add_panel(panel)
示例#13
0
 def __init__(self, parent):
     QWidget.__init__(self, parent)
 
     layout = QGridLayout()
     self.setLayout(layout)
     
     self.plot1 = ImagePlot(self)
     layout.addWidget(self.plot1, 0, 0, 1, 1)
     self.plot2 = ImagePlot(self)
     layout.addWidget(self.plot2, 1, 0, 1, 1)
     
     self.contrast = ContrastAdjustment(self)
     layout.addWidget(self.contrast, 2, 0, 1, 2)
     self.itemlist = PlotItemList(self)
     layout.addWidget(self.itemlist, 0, 1, 2, 1)
     
     self.manager = PlotManager(self)
     for plot in (self.plot1, self.plot2):
         self.manager.add_plot(plot)
     for panel in (self.itemlist, self.contrast):
         self.manager.add_panel(panel)
示例#14
0
 def __init__(self, parent):
     QWidget.__init__(self, parent)
     layout = QHBoxLayout()
     row_nb = 14
     cindex = 0
     for child in dir(QStyle):
         if child.startswith('SP_'):
             if cindex == 0:
                 col_layout = QVBoxLayout()
             icon_layout = QHBoxLayout()
             icon = get_std_icon(child)
             label = QLabel()
             label.setPixmap(icon.pixmap(32, 32))
             icon_layout.addWidget(label)
             icon_layout.addWidget(QLineEdit(child.replace('SP_', '')))
             col_layout.addLayout(icon_layout)
             cindex = (cindex + 1) % row_nb
             if cindex == 0:
                 layout.addLayout(col_layout)
     self.setLayout(layout)
     self.setWindowTitle('Standard Platform Icons')
     self.setWindowIcon(get_std_icon('TitleBarMenuButton'))
示例#15
0
 def __init__(self, parent):
     QWidget.__init__(self, parent)
     layout = QHBoxLayout()
     row_nb = 14
     cindex = 0
     for child in dir(QStyle):
         if child.startswith('SP_'):
             if cindex == 0:
                 col_layout = QVBoxLayout()
             icon_layout = QHBoxLayout()
             icon = get_std_icon(child)
             label = QLabel()
             label.setPixmap(icon.pixmap(32, 32))
             icon_layout.addWidget( label )
             icon_layout.addWidget( QLineEdit(child.replace('SP_', '')) )
             col_layout.addLayout(icon_layout)
             cindex = (cindex+1) % row_nb
             if cindex == 0:
                 layout.addLayout(col_layout)                    
     self.setLayout(layout)
     self.setWindowTitle('Standard Platform Icons')
     self.setWindowIcon(get_std_icon('TitleBarMenuButton'))
示例#16
0
 def setup_instance(self, instance):
     """Override DataSetEditDialog method"""
     from plotpy.dataset.datatypes import DataSetGroup
     assert isinstance(instance, DataSetGroup)
     tabs = QTabWidget()
     #        tabs.setUsesScrollButtons(False)
     self.layout.addWidget(tabs)
     for dataset in instance.datasets:
         layout = QVBoxLayout()
         layout.setAlignment(Qt.AlignTop)
         if dataset.get_comment():
             label = QLabel(dataset.get_comment())
             label.setWordWrap(self.wordwrap)
             layout.addWidget(label)
         grid = QGridLayout()
         self.edit_layout.append(self.layout_factory(dataset, grid))
         layout.addLayout(grid)
         page = QWidget()
         page.setLayout(layout)
         if dataset.get_icon():
             tabs.addTab(page, get_icon(dataset.get_icon()),
                         dataset.get_title())
         else:
             tabs.addTab(page, dataset.get_title())
示例#17
0
    def setup_instance(self, instance):
        """Override DataSetEditDialog method"""
        from plotpy.dataset.datatypes import DataSetGroup
        assert isinstance(instance, DataSetGroup)
        tabs = QTabWidget()
#        tabs.setUsesScrollButtons(False)
        self.layout.addWidget(tabs)
        for dataset in instance.datasets:
            layout = QVBoxLayout()
            layout.setAlignment(Qt.AlignTop)
            if dataset.get_comment():
                label = QLabel(dataset.get_comment())
                label.setWordWrap(self.wordwrap)
                layout.addWidget(label)
            grid = QGridLayout()
            self.edit_layout.append( self.layout_factory(dataset, grid) )
            layout.addLayout(grid)
            page = QWidget()
            page.setLayout(layout)
            if dataset.get_icon():
                tabs.addTab( page, get_icon(dataset.get_icon()),
                             dataset.get_title() )
            else:
                tabs.addTab( page, dataset.get_title() )
示例#18
0
文件: misc.py 项目: qinghhua/plotpy
 def __init__(self, parent):
     if PYQT5:
         super(DockableWidget, self).__init__(parent, parent=parent)
     else:
         QWidget.__init__(self, parent)
         DockableWidgetMixin.__init__(self, parent)
示例#19
0
 def __init__(self, wintitle=None, icon="plotpy.svg", toolbar=False,
              options=None, parent=None, panels=None,
              param_cols=1, legend_anchor='TR', auto_fit=False):
     QWidget.__init__(self, parent)
     FitWidgetMixin.__init__(self, wintitle, icon, toolbar, options, panels,
                             param_cols, legend_anchor, auto_fit)
示例#20
0
 def __init__(self):
     QWidget.__init__(self)
     self.setWindowTitle("Signal filtering (plotpy)")
     self.setWindowIcon(get_icon('plotpy.svg'))
     hlayout = QHBoxLayout()
     self.setLayout(hlayout)
示例#21
0
 def setup_widget_layout(self):
     self.addToolBar(self.toolbar)
     widget = QWidget()
     widget.setLayout(self.plot_layout)
     self.setCentralWidget(widget)
示例#22
0
 def setup_widget_layout(self):
     self.addToolBar(self.toolbar)
     widget = QWidget()
     widget.setLayout(self.plot_layout)
     self.setCentralWidget(widget)
示例#23
0
 def resizeEvent(self, event):
     QWidget.resizeEvent(self, event)
     self.get_plot().replot()
示例#24
0
 def resizeEvent(self, event):
     QWidget.resizeEvent(self, event)
     self.get_plot().replot()