123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392 |
- .. This is a autogemerated documentation from python docstrings. It was generated using DStrings2Doc.
- .. module:: kcgwidget
- .. _kcgwidget:
- Module kcgwidget
- ================
- Base Classes used in KCG.
- This module also contains various helpful Classes to make live easier ;)
- .. py:method:: tr(_, x)
- Dummy Translation method that does not translate
- :param _: unused
- :param x: the string to "translate"
- :return: x
- .. py:class:: BigIconButton(QtGui.QPushButton)
- This is a Button with a big Icon (that can fill the whole button)
- .. py:method:: __init__(self, path, width, height, connect=None, tooltip=None, parent=None)
- Setting various properties
- :param path: (str) the path to the icon
- :param width: (int) with of the button
- :param height: (int) height of the button
- :param connect: (callable) function to call when button is pressed
- :param tooltip: (str) tool tip to show
- :param parent: (QWidget) parent widget.
- .. py:class:: clickLabel(QtGui.QLabel)
- Clickable Label
- .. py:method:: mouseReleaseEvent(self, QMouseEvent)
- Reimplementation of QLabel.mouseReleaseEvent to make this clickable
- .. py:class:: ClickableHBoxLayout(QtGui.QHBoxLayout)
- A clickable HBoxLayout
- .. py:method:: event(self, QEvent)
- Reimplementation of QHBoxLayout.event to make it clickable
- .. py:class:: switchLabel(QtGui.QLabel)
- This implements a Switch.
- It switches between left and right.
- .. py:method:: __init__(self, startRight=False):
- Initialise switchLabel
- As a normal Button it emits the clicked event when clicked.
- It does NOT have two events for each side at the moment.
- :param startRight: (bool) whether the switch is initially set to the right position (default is left (False))
- .. py:method:: mouseReleaseEvent(self, QMouseEvent)
- Reimplementation of QLabel.mouseReleaseEvent to make it clickable
- .. py:class:: Switch(QtGui.QWidget)
- A Simple Switch
- .. py:method:: __init__(self, leftLabel, rightLabel, startRight=False)
- .. py:method:: state(self)
- Get the state of this switch
- :return: the state of this switch
- .. py:class:: ClickableSVG(QtGui.QWidget)
- This implements a clickable SVG Image
- .. py:method:: __init__(self, path, width, height, wwidth=None, wheight=None, parent=None)
- Initialisation of ClickabeSVG
- :param path: (str) path to the svg file
- :param width: (int) width of the svg
- :param height: (int) height of the svg
- :param wwidth: (int) width of the widget (not the svg)
- :param wheight: (int) height of the widget (not the svg)
- :param parent: (QWidget) parent widget of the ClickableSVG
- .. py:method:: mouseReleaseEvent(self, QMouseEvent)
- Reimplementation of QWidget.mouseReleaseEvent to make it clickable
- .. py:method:: changeSvg(self, path)
- Change the SVG of this widget
- :param path: (str) path to the new svg file
- .. py:class:: KCGWidgets(QtGui.QWidget)
- Base Class for alsmost all Widgets used in KCG.
- It holds various properties as well as methods that simplify creation of certain objects such as labels, buttons ...
- .. py:method:: __init__(self, name=None, parent=None)
- Initialise this baseclass
- :param name: (str) name of the widget
- :param parent: (QWidget) parent of this widget
- .. py:method:: theType(self)
- Type of this widget
- .. py:method:: theId(self)
- ID of this widget
- .. py:method:: theName(self)
- Name of this widget
- .. py:method:: theType(self, t)
- Setter for the type of this widget
- :param t: (int) type
- .. py:method:: theId(self, i)
- Setter for the id of this widget
- :param i: (int) id
- .. py:method:: theName(self, n)
- Setter for the name of this widget
- :param n: (str) name
- .. py:method:: createButton(self, text="", x=None, y=None, dimensions=None, tooltip="", connect=False, icon=None)
- Create a Button
- :param text: (str) Text to display on the button
- :param x: (int) x-position
- :param y: (int) y-position
- :param dimensions: (QSize) dimensions of the button
- :param tooltip: (str) tooltip to display
- :param connect: (callable) connect the button pressed event to this callable
- :param icon: (QIcon) Icon to display on the button
- .. py:method:: createLabel(self, text=None, image=None, tooltip=None, click=False, connect=None)
- Create a Label
- :param text: (str) Text to display on this label
- :param image: (QPixmap) Image to display on this label
- :param tooltip: (str) tooltip to display
- :param click: (bool) make this a clickable label?
- :param connect: (callable) if click is true, connect the clicked event to this callable
- .. py:method:: createSpinbox(self, min, max, interval=1, start_value=0, connect=None)
- create a Spinbox
- :param min: (int) minimum Value
- :param max: (int) maximum Value
- :param interval: (int) interval
- :param start_value: (int) start Value
- :param connect: (callable) function to call on value change
- .. py:method:: createInput(self, text=None, read_only=False, width=None)
- Create Input
- :param text: (str) Default Text
- :param read_only: (bool) set input as read only
- :param width: (int) width of the input field in pixels
- .. py:method:: createCheckbox(self, text="", tooltip="", checked=False, connect=None)
- Create Checkbox
- :param tooltip: (str) what tooltip text to display
- :param checked: (bool) Checkt as default?
- :param connect: (callable) function to connect
- .. py:method:: createSwitch(self, startRight=False, connect=None)
- Create a Switch
- :param startRight: (bool) if this is True the initial setting is set to right (default is left)
- :param connect: (callable) connect the switches clicked event to this callable
- .. py:method:: closeEvent(self, event)
- Reimplementation of QWidget.closeEvent
- .. py:class:: KCGSubWidget(QtGui.QMdiSubWindow)
- Base Class for Subwindows in the KCG Gui
- .. py:method:: __init__(self, name=None, unique_id=None, typ=None, minSize=False)
- Initialise a Subwindow
- :param name: (str) name of this window
- :param unique_id: (int) unique id of this window
- :param typ: (int) type of this window
- :param minSize: (bool) whether the window is to be resized to its minimum size
- .. py:method:: theType(self)
- Type of this widget
- .. py:method:: theId(self)
- ID of this widget
- .. py:method:: theName(self)
- Name of this widget
- .. py:method:: theType(self, t)
- Setter for the type of this widget
- :param t: (int) type
- .. py:method:: theId(self, i)
- Setter for the id of this widget
- :param i: (int) id
- .. py:method:: theName(self, n)
- Setter for the name of this widget
- :param n: (str) name
- .. py:class:: AccordionClickLine(QtGui.QWidget)
- A simple clickable line used in the accordion widget below
- .. py:method:: __init__(self, text)
- .. py:method:: mouseReleaseEvent(self, QMouseEvent)
- Reimplementation of QWidget.mouseReleaseEvent to make it clickable
- .. py:method:: expand(self, state)
- Expand or deexpand the Accordion entry
- :param state: True to expand False to deexpand
- .. py:class:: AccordionWidget(QtGui.QWidget):
- Simple accordion widget similar to QToolBox
- .. py:method:: __init__(self)
- Initialise the accordion widget
- .. py:method:: resizeEvent(self, QResizeEvent)
- Reimplementation of QWidget.resizeEvent to make it look nice
- .. py:method:: addItem(self, widget, text)
- Add a Widget to the Accordion widget
- :param widget: the widget to add
- :param text: the text for this widget
- .. py:method:: toggleIndex(self, index)
- Toggle the visibility of the widget with index index
- :param index: the index to toggle
- .. py:method:: expandIndex(self, index)
- Expand the widget with index index
- :param index: the index of the widget to show
- .. py:method:: hideIndex(self, index)
- Hide the widget with the index index
- :param index: the index of the widget to hide
- .. py:method:: hideAll(self)
- Hide all widgets
- .. py:method:: showAll(self)
- Show all widgets
- .. py:class:: MultilineInputDialog(QtGui.QDialog)
- Multiline Input Dialog
- When using this dialog, create is and open it with get_text. this also returns the entered text.
- .. py:method:: __init__(self)
- .. py:method:: fill(self, heading, label)
- Fill the widget with elements
- :param heading: (str) the heading of this widget
- :param label: (str) the text to show above the input field
- .. py:method:: ok(self)
- This gets executed when the ok button is pressed
- .. py:method:: cancel(self)
- This gets executed when the cancel button is pressed
- .. py:method:: get_text(self, heading, label)
- This function is the main entry point.
- :param heading: (str) the heading of the widget
- :param label: (str) the text to show above the input field
- :return: (unicode) the entered text
- .. py:class:: IdGenerator()
- Generate Unique Id for every subwindow
- .. py:method:: genid(self)
- Generate a new Id
- .. py:method:: register_widget_creation_function(creation_func)
- Register the function to create a certain widget
- :param creation_func: (callable) function to call when the widget is to be created
- .. py:method:: register_widget(icon, text, target, shortcut=None)
- Register a widget
- :param icon: (QIcon) Icon to show on the toolbar button
- :param text: (str) tooltip for the toolbar button
- :param target: (callable) the function to create the widget
- :param shortcut: (str) keyboard shortcut to open this widget
- .. py:method:: get_registered_widgets()
- Get the registered widgets
- :return: (list) list of registered widgets
- .. py:method:: get_registered_widget_functions()
- Get the functions that are registered
- :return: (list) list of functions
- .. py:method:: error(code, text, severe=False)
- Log an error using the logging module
- :param code: the error code
- :param text: the text to show
- :param severe: if it is a severe error that has to quit the program
|