示例#1
0
def main():
    """  Main function for console execution """
    # Parse arguments
    file_name, depth, backup, debug_level = parse_command_line_args()
    # Create Log Handler
    stream_sequence_logs(sys.stdout, debug_level)
    # Load sequence
    engine = SequenceEngine()
    try:
        engine.load(file_name, depth, backup)
    except Exception as exc:
        print(exc)
        return
    # Wait for input
    try:
        res = raw_input("Press 'r' to run, any other key to abort: ")
    except KeyboardInterrupt:
        res = 'a'
    if res.lower() == 'r':
        print("RUN")
        engine.start()
        boolean = False
        while not boolean:
            try:
                boolean = engine.wait(1)
            except KeyboardInterrupt:
                print("USER STOP")
                engine.interrupt()
        print("FINISHED")
示例#2
0
 def __init__(self, *args, **kwargs):
     # Init widget
     super(ControlWidget, self).__init__(*args, **kwargs)
     # Create load button
     self.load_button = QtGui.QToolButton(self)
     url = u":/control_icons/icons/go-bottom.png"
     self.load_button.setIcon(QtGui.QIcon(url))
     self.load_button.setIconSize(QtCore.QSize(32, 32))
     self.load_button.clicked.connect(self.on_load)
     self.load_button.setShortcut(QtGui.QKeySequence("F5"))
     self.load_button.setToolTip("Load the sequence (F5)")
     # Create run button
     self.run_button = QtGui.QToolButton(self)
     url = u":/control_icons/icons/go-next.png"
     self.run_button.setIcon(QtGui.QIcon(url))
     self.run_button.setIconSize(QtCore.QSize(32, 32))
     self.run_button.clicked.connect(self.on_run)
     self.run_button.setShortcut(QtGui.QKeySequence("F6"))
     self.run_button.setToolTip("Run the sequence (F6)")
     # Create stop button
     self.stop_button = QtGui.QToolButton(self)
     url = u":/control_icons/icons/process-stop.png"
     self.stop_button.setIcon(QtGui.QIcon(url))
     self.stop_button.setIconSize(QtCore.QSize(32, 32))
     self.stop_button.clicked.connect(self.on_stop)
     self.stop_button.setShortcut(QtGui.QKeySequence("F7"))
     self.stop_button.setToolTip("Stop the sequence (F7)")
     # Create layout
     self.layout = QtGui.QHBoxLayout(self)
     self.layout.addWidget(self.load_button)
     self.layout.addWidget(self.run_button)
     self.layout.addWidget(self.stop_button)
     # Init attributes
     self.layout.setMargin(0)
     self.engine = SequenceEngine()
     self.enabled = False
     self.file_path = ""
     self.path_request_enabled = False
     self.disable()