enums module¶
-
class
campos.enums.
BaseEnum
[source]¶ Bases:
enum.Enum
Base enumeration class
-
classmethod
get_member
(arg)[source]¶ Facilitates access to enum members using the shortcuts below.
If arg is a member of this enum returns arg.
If arg is an str then a case-insensitive search is done among enum members looking for one whose name matches arg.
If no member is found with name equal to arg then:
- If
arg.upper() == 'CURRENT'
and the enum is subclass ofHasCurrent
theget_current()
method is called. - Else, if
arg.upper() == 'DEFAULT'
and the enum is subclass ofHasDefault
thedefault()
method is called.
- If
Parameters: arg (enum member or str
.) – a member object or a string representing its name, ‘current’ or ‘default’ if supported.Returns: an enum member. Raises ValueError: if a member couldn’t be found using arg.
-
classmethod
-
class
campos.enums.
HasDefault
[source]¶ Bases:
object
Behavior to implement in order to give a
BaseEnum
subclass the ability to provide a default value.See also
-
class
campos.enums.
HasCurrent
[source]¶ Bases:
object
Behavior to implement in order to give a
BaseEnum
subclass the ability to globally set and obtain a current value.See also
-
classmethod
get_current
()[source]¶ Obtains the current value of a
BaseEnum
subclass.If a current value has not been established using
set_current()
and the enum is anHasDefault
subclass then thedefault()
method is called, otherwise anAttributeError
is raised.Examples: Validation.get_current() Validation.get_member(‘current’)
Returns: the current enum member or the default value if supported. Raises AttributeError: if no value has been established using set_current()
and the enum is not aHasDefault
subclass.
-
classmethod
set_current
(value)[source]¶ Establish the current value of a
BaseEnum
subclass.value is processed using
BaseEnum.get_member()
, therefore all its shortcuts can be used here.Example: Labelling.set_current(‘left’)
Parameters: value (all values supported by BaseEnum.get_member()
) – enum member to set as the current one.Raises ValueError: if a member couldn’t be found using value.
-
classmethod
-
class
campos.enums.
Labelling
¶ Bases:
campos.enums.HasDefault
,campos.enums.HasCurrent
,campos.enums.BaseEnum
Possible positions to display a label in fields, default is ‘left’
-
LEFT
= None¶ Left to the field
-
TOP
= None¶ On top of the field
-
-
class
campos.enums.
Validation
¶ Bases:
campos.enums.HasDefault
,campos.enums.HasCurrent
,campos.enums.BaseEnum
Available validation mechanisms to be used in fields, the default is ‘instant’
-
INSTANT
= None¶ Validation occurs any time the value of a field changes.
-
MANUAL
= None¶ Validation is left to the user.
-
-
class
campos.enums.
ButtonType
[source]¶ Bases:
campos.enums.BaseEnum
Available button types, this enum’s members are shortcuts to Qt’s StandardButtons enum
-
ABORT
= None¶ QDialogButtonBox.Abort
-
APPLY
= None¶ QDialogButtonBox.Apply
-
CANCEL
= None¶ QDialogButtonBox.Cancel
-
CLOSE
= None¶ QDialogButtonBox.Close
-
DISCARD
= None¶ QDialogButtonBox.Discard
-
HELP
= None¶ QDialogButtonBox.Help
-
IGNORE
= None¶ QDialogButtonBox.Ignore
-
NO
= None¶ QDialogButtonBox.No
-
NO_TO_ALL
= None¶ QDialogButtonBox.NoToAll
-
OK
= None¶ QDialogButtonBox.Ok
-
OPEN
= None¶ QDialogButtonBox.Open
-
RESET
= None¶ QDialogButtonBox.Reset
-
RESTORE_DEFAULTS
= None¶ QDialogButtonBox.RestoreDefaults
-
RETRY
= None¶ QDialogButtonBox.Retry
-
SAVE
= None¶ QDialogButtonBox.Save
-
SAVE_ALL
= None¶ QDialogButtonBox.SaveAll
-
YES
= None¶ QDialogButtonBox.Yes
-