コード例 #1
0
 def _make_welcome(self):
     welcome = QState(self.run)
     begin = QState(welcome)
     finalize = QFinalState(welcome)
     welcome.setInitialState(begin)
     begin.assignProperty(self.label_msg, "text", "Welcome!")
     begin.assignProperty(self.button_right, "text", "Start")
     begin.assignProperty(self.button_right, "visible", True)
     begin.assignProperty(self.button_left, "visible", False)
     begin.addTransition(self.button_right.clicked, finalize)
     return welcome
コード例 #2
0
    def _make_good_bye(self):
        good_bye = QState(self.run)
        begin = QState(good_bye)
        finalize = QFinalState(good_bye)
        good_bye.assignProperty(
            self.label_msg, "text",
            "<html>That's all for now. Hope you liked it.</html>")
        good_bye.assignProperty(self.button_left, "visible", False)
        good_bye.assignProperty(self.button_right, "enabled", True)
        good_bye.assignProperty(self.button_right, "text", "Close")

        good_bye.setInitialState(begin)
        begin.addTransition(self.button_right.clicked, finalize)
        return good_bye
コード例 #3
0
    def _make_select_more(self):
        select_more = QState(self.run)
        begin = QState(select_more)
        simulate = QState(select_more)
        finalize = QFinalState(select_more)
        begin.assignProperty(self.parent().ui.dockWidget_object_tree,
                             "visible", True)
        sticky = self.parent().qsettings.value("appSettings/stickySelection",
                                               defaultValue="false")
        note = " (by holding down the <b>Ctrl</b> key)" if sticky == "false" else ""
        text = f"""
            <html>
            <p>Selecting multiple items{note} makes things more interesting.</p>
            <p>Press <b>Show</b> to see it in action.</p>
            </html>
        """
        begin.assignProperty(self.label_msg, "text", text)
        begin.assignProperty(self.button_right, "text", "Show")
        begin.assignProperty(self.button_right, "enabled", True)
        simulate.assignProperty(self.parent().ui.dockWidget_object_tree,
                                "visible", True)
        simulate.assignProperty(self.button_right, "enabled", False)

        select_more.setInitialState(begin)
        transition = begin.addTransition(self.button_right.clicked, simulate)
        animation = SelectionAnimation(self.parent(),
                                       command=QItemSelectionModel.Select)
        transition.addAnimation(animation)
        simulate.addTransition(animation.finished, finalize)
        return select_more
コード例 #4
0
    def _make_select_one(self):
        select_one = QState(self.run)
        begin = QState(select_one)
        simulate = QState(select_one)
        finalize = QFinalState(select_one)
        begin.assignProperty(self.parent().ui.dockWidget_object_tree,
                             "visible", True)
        text = """
            <html>
            <p>Selecting items in the object tree automatically triggers
            graph generation.</b><br />
            <p>Press <b>Show</b> to see it in action.</p>
            </html>
        """
        begin.assignProperty(self.label_msg, "text", text)
        begin.assignProperty(self.button_right, "text", "Show")
        begin.assignProperty(self.button_right, "enabled", True)
        simulate.assignProperty(self.parent().ui.dockWidget_object_tree,
                                "visible", True)
        simulate.assignProperty(self.button_right, "enabled", False)

        select_one.setInitialState(begin)
        transition = begin.addTransition(self.button_right.clicked, simulate)
        animation = SelectionAnimation(
            self.parent(), command=QItemSelectionModel.ClearAndSelect)
        transition.addAnimation(animation)
        simulate.addTransition(animation.finished, finalize)
        return select_one
コード例 #5
0
 def _make_state(self, name):
     s = QState(self.machine)
     s.assignProperty(self, "current_state", name)
     return s