kcgwidget.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. KCGWidget Module
  2. ================
  3. .. module:: kcgwidget
  4. This module is the backbone of the Gui.
  5. Classes
  6. -------
  7. .. _kcgwidgets_helper_methods:
  8. .. py:class:: KCGWidgets
  9. This class is the base class to most of the used widget classes in the Gui.
  10. .. py:method:: __init__(self [, name, parent ])
  11. :param str name: Name of the widget
  12. :param object parent: Parent object
  13. .. py:method:: createButton(self [, text, x, y, dimensions, tooltip, connect, icon ])
  14. Create a simple PushButton
  15. :param str text: Text to be displayed on the button
  16. :param int x, y: Coordinates of the Button (only if used without layout)
  17. :param PyQt4.QtCore.QSize) dimensions: Size of the button
  18. :param str tooltip: Tooltip
  19. :param callable connect: Callable to call when button is pressed
  20. :param PyQt4.QtGui.QIcon icon: Icon to display on the button
  21. :return: New Button
  22. :rtype: PyQt4.QtGui.QPushButton
  23. .. py:method:: createLabel(self [, text, image, tooltip, [click=False, connect ] ])
  24. Create a simple Label
  25. :param str text: Text for the Label
  26. :param PyQt4.QtGui.QPixmap) image: Pixmap to set as image
  27. :param str tooltip: Tooltip
  28. :param bool click: Whether this label is clickable or not
  29. :param callable connect: If the label is clickable, connect the click signal to this callable
  30. :return: New Label
  31. :rtype: PyQt4.QtGui.QLabel
  32. .. py:method:: createSpinbox(self, min, max [, interval=1, start_value=0, connect ])
  33. Create a simple Spinbox
  34. :param int min: Minimum value
  35. :param int max: Maximum value
  36. :param int interval: The Stepwidth
  37. :param int start_value: Initial Value
  38. :param callable connect: Connect changed signal to this callable
  39. :return: Integer selection input field
  40. :rtype: PyQt4.QtGui.QSpinbox
  41. .. py:method:: createInput(self [, text, read_only=False, width ])
  42. Create a simple text input field
  43. :param str text: Initial text in the input field
  44. :param bool read_only: Whether this field is editable
  45. :param int width: Width of this field in pixels (None means auto-width)
  46. :return: Text input field
  47. :rtype: PyQt4.QtGui.QLineEdit
  48. .. py:method:: createCheckbox(self [, text, tooltip, checked=False, connect ])
  49. Create a simple Checkbox
  50. :param str text: Text to show next to the checkbox
  51. :param str tooltip: Tooltip
  52. :param bool checked: Initial state of the checkbox
  53. :param callable connect: Connect changed signal to this callable
  54. :return: New Checkbox
  55. :rtype: PyQt4.QtGui.QCheckBox
  56. .. py:attribute:: theType
  57. Type of the widget (int)
  58. .. py:attribute:: theId
  59. Unique ID of the widget (int)
  60. .. py:attribute:: theName
  61. Name of the widget (str)
  62. .. py:class:: BigIconButton
  63. Button with a big Icon
  64. .. py:method:: __init__(self, path, width, height [, connect, tooltip, parent ])
  65. Initialize and create a BigIconButton
  66. :param str path: Path to the icon file
  67. :param int width: Width
  68. :param int height: height
  69. :param callable connect: Connect clicked signal to this callable
  70. :param str tooltip: Tooltip
  71. :param object parent: Parent object
  72. .. py:class:: clickLabel
  73. Clickable Label
  74. .. _kcgwidget_register_widget:
  75. Registering Widgets
  76. -------------------
  77. .. py:method:: register_widget(icon, text, target, [shortcut])
  78. When a widget is registered, all necessary steps to add a toolbar button and a menu entry for opening the widget are
  79. automatically performed at the correct places.
  80. :param PyQt4.QtGui.QIcon icon: The icon to use in the toolbar and menu.
  81. :param str text: Text to use as tooltip for the toolbar button and as text in the menu.
  82. :param callable target: The function that "opens" the widget see :ref:`add_widget_function`.
  83. :param str shortcut: Keyboard shortcut to open the widget.
  84. .. py:method:: register_widget_creation_function(creation_func)
  85. Use this function to register callables that have to be called after creation of the Gui
  86. :param callable creation_func: The function that is to be called.