Beispiel #1
0
    def __init__(self, parent=None, fname=IOTool.get_file_name()):
        super(OutputFileWidget, self).__init__(parent)

        # main layout of the form is the verticallayout

        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")

        #moved the script stuff to a separate widget that lives in the toolbar

        self.outputLayout = QtGui.QHBoxLayout()
        self.outputLayout.setObjectName("outputLayout")
        self.outputFileLabel = QtGui.QLabel(self)
        self.outputFileLabel.setText("Output File:")
        self.outputFileLineEdit = QtGui.QLineEdit(self)
        self.outputFileButton = QtGui.QPushButton(self)
        self.outputFileButton.setText("Browse")
        self.outputLayout.addWidget(self.outputFileLabel)
        self.outputLayout.addWidget(self.outputFileLineEdit)
        self.outputLayout.addWidget(self.outputFileButton)
        self.verticalLayout.addLayout(self.outputLayout)

        self.headerTextEdit = QtGui.QPlainTextEdit("")
        fontsize = self.headerTextEdit.fontMetrics()
        self.headerTextEdit.setFixedHeight(fontsize.lineSpacing() * 8)
        self.verticalLayout.addWidget(self.headerTextEdit)

        # moved the start stop button to the toolbar only

        self.setLayout(self.verticalLayout)

        self.outputFileLineEdit.setText(fname)

        self.connect(self.outputFileButton, SIGNAL('clicked()'),
                     self.on_outputFileButton_clicked)

        self.setSizePolicy(
            QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                              QtGui.QSizePolicy.Maximum))
Beispiel #2
0
def add_widget_into_main(parent):
    """add a widget into the main window of LabGuiMain
    
    create a QDock widget and store a reference to the widget
    """

    ofname = IOTool.get_file_name(config_file_path=parent.config_file)

    mywidget = OutputFileWidget(parent=parent, fname=ofname)

    outDockWidget = QtGui.QDockWidget("Output file and header text", parent)
    outDockWidget.setObjectName("OutputFileDockWidget")
    outDockWidget.setAllowedAreas(Qt.LeftDockWidgetArea
                                  | Qt.RightDockWidgetArea)

    #fill the dictionnary with the widgets added into LabGuiMain
    parent.widgets['OutputFileWidget'] = mywidget

    outDockWidget.setWidget(mywidget)
    parent.addDockWidget(Qt.RightDockWidgetArea, outDockWidget)

    #Enable the toggle view action
    parent.windowMenu.addAction(outDockWidget.toggleViewAction())