parameters: (self)
docstring: Execute when the command is called.
docstring_summary: Execute when the command is called.
docstring_tokens: Execute when the command is called .
function: def Activated(self):
          """Execute when the command is called."""
          super(LineSlope, self).Activated()
  
          # for obj in Gui.Selection.getSelection():
          #     if utils.get_type(obj) != "Wire":
          #         _msg(translate("draft",
          #                        "This tool only works with "
          #                        "Draft Lines and Wires"))
          #         return
  
          # TODO: create a .ui file with QtCreator and import it here
          # instead of creating the interface programmatically,
          # see the `gui_othoarray` module for an example.
          w = QtGui.QWidget()
          w.setWindowTitle(translate("Draft", "Slope"))
          layout = QtGui.QHBoxLayout(w)
          label = QtGui.QLabel(w)
          label.setText(translate("Draft", "Slope")+":")
          layout.addWidget(label)
          self.spinbox = QtGui.QDoubleSpinBox(w)
          self.spinbox.setMinimum(-9999.99)
          self.spinbox.setMaximum(9999.99)
          self.spinbox.setSingleStep(0.01)
          _tip = ("New slope of the selected lines.\n"
                  "This is the tangent of the horizontal angle:\n"
                  "0 = horizontal\n"
                  "1 = 45 deg up\n"
                  "-1 = 45deg down\n")
          label.setToolTip(translate("Draft", _tip))
          self.spinbox.setToolTip(translate("Draft", _tip))
          layout.addWidget(self.spinbox)
  
          # In order to display our interface inside the task panel
          # we must contain our interface inside a parent widget.
          # Then our interface must be installed in this parent widget
          # inside the attribute called "form".
          taskwidget = QtGui.QWidget()
          taskwidget.form = w
  
          # The "accept" attribute of the parent widget
          # should also contain a reference to a function that will be called
          # when we press the "OK" button.
          # Then we must show the container widget.
          taskwidget.accept = self.accept
          Gui.Control.showDialog(taskwidget)
function_tokens: def Activated ( self ) : super ( LineSlope , self ) . Activated ( ) # for obj in Gui.Selection.getSelection(): #     if utils.get_type(obj) != "Wire": #         _msg(translate("draft", #                        "This tool only works with " #                        "Draft Lines and Wires")) #         return # TODO: create a .ui file with QtCreator and import it here # instead of creating the interface programmatically, # see the `gui_othoarray` module for an example. w = QtGui . QWidget ( ) w . setWindowTitle ( translate ( "Draft" , "Slope" ) ) layout = QtGui . QHBoxLayout ( w ) label = QtGui . QLabel ( w ) label . setText ( translate ( "Draft" , "Slope" ) + ":" ) layout . addWidget ( label ) self . spinbox = QtGui . QDoubleSpinBox ( w ) self . spinbox . setMinimum ( - 9999.99 ) self . spinbox . setMaximum ( 9999.99 ) self . spinbox . setSingleStep ( 0.01 ) _tip = ( "New slope of the selected lines.\n" "This is the tangent of the horizontal angle:\n" "0 = horizontal\n" "1 = 45 deg up\n" "-1 = 45deg down\n" ) label . setToolTip ( translate ( "Draft" , _tip ) ) self . spinbox . setToolTip ( translate ( "Draft" , _tip ) ) layout . addWidget ( self . spinbox ) # In order to display our interface inside the task panel # we must contain our interface inside a parent widget. # Then our interface must be installed in this parent widget # inside the attribute called "form". taskwidget = QtGui . QWidget ( ) taskwidget . form = w # The "accept" attribute of the parent widget # should also contain a reference to a function that will be called # when we press the "OK" button. # Then we must show the container widget. taskwidget . accept = self . accept Gui . Control . showDialog ( taskwidget )