Пример #1
0
    def run_if_main(cls):
        """Passes `cls.init_widget` to rt_qt.run_app if running in main.

        If caller isn't main, does nothing. If called from main, will
        import rt_qt (which imports in PyQt4). Allows controller to be
        tested inline.
        """
        if not pkinspect.is_caller_main():
            return
        from radtrack import rt_qt
        rt_qt.run_app(cls.init_widget)
Пример #2
0
class GenesisTab(QtGui.QWidget):
    defaultTitle = "Genesis"
    acceptsFileTypes = []
    task = "Run an Genesis simulation"
    category = "simulations"

    def __init__(self, parent):
        if parent:
            self.parent = parent
        else:
            self.parent = self

        QtGui.QWidget.__init__(self)
        layout = QtGui.QVBoxLayout(self)
        layout.addWidget(genesis_controller.Base.init_widget(self))
        self.setLayout(layout)
        self.container = self

    def exportToFile(self, fileName=None):
        with open(fileName, "w"):
            pass

    def importFile(self, fileName=None):
        pass


if "__main__" == __name__:
    from radtrack import rt_qt

    rt_qt.run_app(lambda: GenesisTab(None))
Пример #3
0
        else:
            self.parent = self
        QtGui.QWidget.__init__(self)
        self.stackwidget = QtGui.QStackedWidget(self)
        self.stackwidget.addWidget(
            srw_controller.MultiParticle.init_widget(self.stackwidget))
        self.stackwidget.addWidget(
            srw_controller.SingleParticle.init_widget(self.stackwidget))
        self.srw_particle = QtGui.QCheckBox(self)
        self.srw_particle.setText('Single-Particle')
        layout = QtGui.QVBoxLayout(self)
        self.setLayout(layout)
        layout.addWidget(self.srw_particle)
        layout.addWidget(self.stackwidget)
        self.srw_particle.stateChanged.connect(self.togglesrw)
        self.container = self

    def exportToFile(self, fileName = None):
        with open(fileName, 'w'):
            pass

    def importFile(self, fileName = None):
        pass

    def togglesrw(self):
        self.stackwidget.setCurrentIndex(int(self.srw_particle.isChecked()))

if '__main__' == __name__:
    from radtrack import rt_qt
    rt_qt.run_app(lambda: RbSrwTab(None))