Difference between revisions of "IC Python API:RLPy RIDockWidget"
Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_Python_API:RL_Python_Modules|Modules}} ==Detailed Description== This class is custom dock widget. This class provides a widget that can be docked inside a...") |
Chuck (RL) (Talk | contribs) m |
||
Line 1: | Line 1: | ||
{{TOC}} | {{TOC}} | ||
{{Parent|IC_Python_API:RL_Python_Modules|Modules}} | {{Parent|IC_Python_API:RL_Python_Modules|Modules}} | ||
− | + | {{last_modified}} | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | == Description == | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | Provides dock widget related functions such as creating dock widgets and dock-able window related properties. It also allows the registration and unregistration of dock widget callback events. | |
− | + | ||
− | + | == Member Functions == | |
+ | |||
+ | === GetWindow ( self ) === | ||
+ | |||
+ | Get the QWidget address of this dock widget, which can be used to create a PySide representation and later accomodate a Qt '''ui''' or '''qml''' file. | ||
+ | |||
+ | ==== Returns ==== | ||
+ | :The QWidget address for this dock widget - QWidget address | ||
− | # | + | <syntaxhighlight lang="python" line='line'> |
− | + | # Get RIDockWidget QWidget address and add view to the dockwidget | |
+ | main_dockwidget_url = QUrl("...ui path") | ||
+ | main_dockwidget_view = PySide2.QtQuick.QQuickView() | ||
+ | main_dockwidget_view.setSource(main_dockwidget_url) | ||
− | + | main_dockwidget = RLPy.RUi.CreateRDockWidget() | |
− | + | main_pyside_dockwidget = wrapInstance(int(main_dockwidget.GetWindow()), PySide2.QtWidgets.QDockWidget) | |
− | + | main_pyside_dockwidget.setObjectName("Main DockWidget") | |
− | + | main_dockwidget_container = main_pyside_dockwidget.createWindowContainer(main_dockwidget_view) | |
+ | main_dockwidget_container.setMinimumWidth(main_dockwidget_view.width()) | ||
+ | main_dockwidget_container.setMinimumHeight(main_dockwidget_view.height()) | ||
+ | main_pyside_dockwidget.setWidget(main_dockwidget_container) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == | + | |
− | === | + | === GetTitle ( self ) === |
− | <syntaxhighlight lang=" | + | |
− | RLPy. | + | Get the QWidget address of this dock widget's title-bar, which can be used to deploy PySide operations. |
+ | |||
+ | ==== Returns ==== | ||
+ | :The QWidget address of this dock widget's title-bar - QWidget address | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Get RIDockWidget titlebar QWidget address | ||
+ | main_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | main_dockwidget_title_bar_widget = wrapInstance(int(main_dockwidget.GetTitle()), PySide2.QtWidgets.QWidget) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ||
− | === | + | === GetWindowTitle ( self ) === |
− | + | ||
− | + | Get this dock widget's title-bar label text. | |
− | + | ||
− | + | See Also: [[#SetWindowTitle ( self, strTitleName )|SetWindowTitle]] | |
− | + | ||
− | + | ==== Returns ==== | |
− | + | :This dock widget's title text - string | |
− | + | ||
− | + | <syntaxhighlight lang="python" line='line'> | |
− | === | + | # Get RIDockWidget titlebar text |
− | <syntaxhighlight lang=" | + | main_dockwidget = RLPy.RUi.CreateRDockWidget() |
− | RLPy. | + | main_dockwidget_window_title = main_dockwidget.GetWindowTitle() |
+ | print(main_dockwidget_window_title) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ||
− | ==== | + | === SetWindowTitle ( self, strTitleName ) === |
− | + | ||
− | + | Set the label text for this dock widget's title-bar. | |
− | + | ||
− | + | ==== Parameters ==== | |
− | <syntaxhighlight lang=" | + | :'''strTitleName''' [IN] Label text for the title-bar - string |
− | RLPy. | + | |
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Set RIDockWidget titlebar text | ||
+ | main_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | main_dockwidget.SetWindowTitle("Main Dockwidget") | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ||
− | === | + | === SetWidget ( self, pWidget ) === |
− | + | ||
− | + | Insert another widget into this dock widget, by way of its window address, into this dock widget. | |
− | + | ||
− | === | + | ==== Parameters ==== |
− | <syntaxhighlight lang=" | + | :'''pWidget''' [IN] The insert widget's window address. |
− | RLPy. | + | |
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Set RIDockWidget widget window address | ||
+ | main_rl_dlg = RLPy.RUi.CreateRDialog() | ||
+ | main_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | main_dockwidget.SetWidget(main_rl_dlg.GetWindow()) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ||
− | === | + | === SetParent ( self, pWidget ) === |
− | + | ||
− | + | Set the parent widget for this dock widget according to its window address. Currently, the main window is the only viable option as the parent widget. | |
− | + | ||
− | === | + | ==== Parameters ==== |
− | <syntaxhighlight lang=" | + | :'''pWidget''' [IN] Parent widget's window address. |
− | RLPy. | + | |
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Set RIDockWidget parent window address | ||
+ | main_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | main_dockwidget.SetParent(RLPy.RUi.GetMainWindow()) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === Show ( self ) === | |
− | + | ||
− | + | Make this dock widget visible. | |
− | + | ||
− | + | See Also: [[#Hide ( self )|Hide]], [[#Close ( self )|Close]] | |
− | + | ||
− | + | <syntaxhighlight lang="python" line='line'> | |
− | + | # Show RIDockWidget | |
− | === | + | main_dockwidget = RLPy.RUi.CreateRDockWidget() |
− | + | main_dockwidget.SetWindowTitle("Main Dockwidget") | |
− | + | main_dockwidget.Show() | |
− | + | ||
− | + | ||
− | <syntaxhighlight lang=" | + | |
− | RLPy. | + | |
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ||
− | === | + | === Hide ( self ) === |
− | + | ||
− | + | Hide this dock widget, but keep it in system memory. | |
− | + | ||
− | + | See Also: [[#Show ( self )|Show]], [[#Close ( self )|Close]] | |
− | <syntaxhighlight lang=" | + | |
− | RLPy. | + | <syntaxhighlight lang="python" line='line'> |
+ | # Hide RIDockWidget | ||
+ | main_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | main_dockwidget.SetWindowTitle("Main Dockwidget") | ||
+ | main_dockwidget.Show() | ||
+ | main_dockwidget.Hide() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === Close ( self ) === | |
− | + | ||
− | === | + | Close this dock widget and release it from system memory. |
− | + | ||
− | + | See Also: [[#Show ( self )|Show]], [[#Hide ( self )|Hide]] | |
− | + | ||
− | + | <syntaxhighlight lang="python" line='line'> | |
− | <syntaxhighlight lang=" | + | # Close RIDockWidget |
− | RLPy. | + | main_dockwidget = RLPy.RUi.CreateRDockWidget() |
+ | main_dockwidget.SetWindowTitle("Main Dockwidget") | ||
+ | main_dockwidget.Show() | ||
+ | main_dockwidget.Close() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === IsVisible ( self ) === | |
− | + | ||
− | ====Returns==== | + | Check whether if this dock widget is visible or not. |
− | + | ||
− | + | See Also: [[#Show ( self )|Show]], [[#Hide ( self )|Hide]], [[#Close ( self )|Close]] | |
− | + | ||
− | + | ==== Returns ==== | |
− | <syntaxhighlight lang=" | + | :Visibility state of this dock widget - boolean |
− | RLPy. | + | |
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Is RIDockWidget visible | ||
+ | main_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | main_dockwidget.SetWindowTitle("Main Dockwidget") | ||
+ | rl_dockwidget.Show() | ||
+ | is_dockwidget_visible = main_dockwidget.IsVisible() | ||
+ | print(is_dockwidget_visible) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | '''eArea''' [IN] | + | === SetAllowedAreas ( self, eArea ) === |
− | + | ||
− | + | Set the dockable areas for this dock widget. Bit-wise operations can be used to combine and exclude different dock-able areas | |
− | + | ||
− | + | See Also: [[#IsAreaAllowed ( self, eArea )|IsAreaAllowed]] | |
− | + | ||
− | + | ==== Parameters ==== | |
− | + | :'''eArea''' [IN] The dock-able areas for this dock widget - [[IC_Python_API:Enums#RLPy.EDockWidgetAreas|RLPy.EDockWidgetAreas]] | |
− | + | ||
− | + | <syntaxhighlight lang="python" line='line'> | |
− | + | # Set RIDockWidget allowed area | |
− | RLPy. | + | main_dockwidget = RLPy.RUi.CreateRDockWidget() |
+ | main_dockwidget.SetWindowTitle("Main Dockwidget") | ||
+ | main_dockwidget.SetAllowedAreas(RLPy.EDockWidgetAreas_LeftDockWidgetArea) | ||
+ | main_dockwidget.Show() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | ''' | + | === SetFloating ( self, bFloating ) === |
− | + | ||
− | + | Set the floating state of this dock widget. Currently, only a value of '''True''' takes effect. | |
− | === | + | |
− | <syntaxhighlight lang=" | + | See Also: [[#IsFloating ( self )|IsFloating]] |
− | RLPy. | + | |
+ | ==== Parameters ==== | ||
+ | :'''bFloating''' [IN] The float state for this dock widget - boolean | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Set RIDockWidget floating status | ||
+ | main_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | main_dockwidget.SetWindowTitle("Main Dockwidget") | ||
+ | main_dockwidget.SetFloating(True) | ||
+ | main_dockwidget.Show() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === SetFeatures ( self, eFeatures ) === | |
− | + | ||
− | + | Allow this dock widget to be movable, closable, and floatable. The feature parameter can be treated with bit-wise operations. The available [[IC_Python_API:Enums#RLPy.EDockWidgetFeatures|RLPy.EDockWidgetFeatures]] match those inside PySide2.QtCore.Qt. | |
− | === | + | |
− | <syntaxhighlight lang=" | + | See Also: [[#Features ( self )|Features]] |
− | RLPy. | + | |
+ | ==== Parameters ==== | ||
+ | :'''eFeatures''' [IN] Features flags to be applied to this dock widget - [[IC_Python_API:Enums#RLPy.EDockWidgetFeatures|RLPy.EDockWidgetFeatures]] | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Set RIDockWidget [[#Features ( self )|Features]] | ||
+ | main_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | main_dockwidget.SetWindowTitle("Main Dockwidget") | ||
+ | main_dockwidget.SetFeatures(RLPy.EDockWidgetFeatures_Movable) | ||
+ | main_dockwidget.Show() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === Features ( self ) === | |
− | + | ||
− | + | Get all of the feature flags applied to this dock widget. | |
− | === | + | |
− | <syntaxhighlight lang=" | + | See also: [[#SetFeatures ( self, eFeatures )|SetFeatures]] |
− | RLPy. | + | |
+ | ==== Returns ==== | ||
+ | :All feature flags on this dock widget - [[IC_Python_API:Enums#RLPy.EDockWidgetFeatures|RLPy.EDockWidgetFeatures]] | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Get RIDockWidget [[#Features ( self )|Features]] | ||
+ | main_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | main_dockwidget.SetWindowTitle("Main Dockwidget") | ||
+ | main_dockwidget.SetFeatures(RLPy.EDockWidgetFeatures_Movable) | ||
+ | main_dockwidget.Show() | ||
+ | features = rl_dockwidget.Features() | ||
+ | print(features) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === IsAreaAllowed ( self, eArea ) === | |
− | + | ||
− | + | Check if this dock widget can be docked into a certain region of the application. | |
− | === | + | |
− | <syntaxhighlight lang=" | + | See Also: [[#SetAllowedAreas ( self, eArea )|SetAllowedAreas]] |
− | RLPy. | + | |
+ | ==== Returns ==== | ||
+ | :returns '''True''' if this dock widget can dock with the region in question, else '''False''' - boolean | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Is RIDockWidget area allowed | ||
+ | main_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | main_dockwidget.SetWindowTitle("Main Dockwidget") | ||
+ | main_dockwidget.SetAllowedAreas(RLPy.EDockWidgetAreas_LeftDockWidgetArea) | ||
+ | main_dockwidget.Show() | ||
+ | is_dockwidget_area_allowed = main_dockwidget.IsAreaAllowed(RLPy.EDockWidgetAreas_LeftDockWidgetArea) | ||
+ | print(is_dockwidget_area_allowed) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | ' | + | === IsFloating ( self ) === |
− | + | ||
− | + | Check if this dock widget is floating (not docked to the application's main window). | |
− | === | + | |
− | <syntaxhighlight lang=" | + | See also: [[#SetFloating ( self, bFloating )|SetFloating]] |
− | RLPy. | + | |
+ | ==== Returns ==== | ||
+ | :Floating status of this dock widget - boolean | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Get RIDockWidget floating status | ||
+ | main_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | main_dockwidget.SetWindowTitle("Main Dockwidget") | ||
+ | main_dockwidget.Show() | ||
+ | is_dockwidget_floating = main_dockwidget.IsFloating() | ||
+ | print(is_dockwidget_floating) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === RegisterNativeEventCallback ( self, pfCallback ) === | |
− | ''' | + | Register a [[IC_Python_API:RLPy_RWinMessageCallback|RWinMessageCallback]] with this dock widget and returns its ID. |
− | + | ||
− | + | See Also: [[#UnregisterNativeEventCallback ( self, uId )|UnregisterNativeEventCallback]], [[#UnregisterNativeEventCallbacks ( self, kIds )|UnregisterNativeEventCallbacks]] | |
− | === | + | |
− | <syntaxhighlight lang=" | + | ==== Parameters ==== |
− | RLPy. | + | :'''pfCallback''' [IN] The Windows message callback for registration - [[IC_Python_API:RLPy_RWinMessageCallback|RWinMessageCallback]] |
+ | |||
+ | ==== Returns ==== | ||
+ | :ID of the unregsitered [[IC_Python_API:RLPy_RWinMessageCallback|RWinMessageCallback]] - integer | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Define RWinMessageCallback | ||
+ | class WinMessageCallback(RLPy.RWinMessageCallback): | ||
+ | def __init__(self): | ||
+ | RLPy.RWinMessageCallback.__init__(self) | ||
+ | |||
+ | def OnWinMsgReceieved(self, data): | ||
+ | print("window message received") | ||
+ | |||
+ | # Register RIDockWidget native event callback | ||
+ | rl_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | rl_dockwidget.SetWindowTitle("main_dockwidget") | ||
+ | native_event_callback = WinMessageCallback() | ||
+ | dialog_register_id = rl_dockwidget.RegisterNativeEventCallBack(native_event_callback) | ||
+ | print(dialog_register_id) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === UnregisterNativeEventCallback ( self, uId ) === | |
− | + | ||
− | === | + | |
− | + | ||
− | + | Unregister a [[IC_Python_API:RLPy_RWinMessageCallback|RWinMessageCallback]] from this dock widget. | |
− | ''' | + | See Also: [[#RegisterNativeEventCallback ( self, pfCallback )|RegisterNativeEventCallback]], [[#UnregisterNativeEventCallbacks ( self, kIds )|UnregisterNativeEventCallbacks]] |
− | + | ||
− | + | ==== Parameters ==== | |
− | === | + | :'''uId''' [IN] ID of the unregisterd [[IC_Python_API:RLPy_RWinMessageCallback|RWinMessageCallback]] - integer |
− | <syntaxhighlight lang=" | + | |
− | RLPy. | + | ==== Returns ==== |
+ | :Success - RLPy.RStatus.Success | ||
+ | :Failure - RLPy.RStatus.Failure | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Define RWinMessageCallback | ||
+ | class WinMessageCallback(RLPy.RWinMessageCallback): | ||
+ | def __init__(self): | ||
+ | RLPy.RWinMessageCallback.__init__(self) | ||
+ | |||
+ | def OnWinMsgReceieved(self, data): | ||
+ | print("window message received") | ||
+ | |||
+ | # Unregister RIDockWidget native event callback | ||
+ | rl_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | rl_dockwidget.SetWindowTitle("main_dockwidget") | ||
+ | native_event_callback = WinMessageCallback() | ||
+ | dialog_register_id = rl_dialog.RegisterNativeEventCallBack(native_event_callback) | ||
+ | result = rl_dockwidget.UnregisterNativeEventCallback(dialog_register_id) | ||
+ | print(result) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | '''kIds''' [IN] callback ids - | + | === UnregisterNativeEventCallbacks ( self, kIds ) === |
− | + | ||
− | ==== | + | Unregister a collection of [[IC_Python_API:RLPy_RWinMessageCallback|RWinMessageCallback]] from this dock widget. If unregistration of one of the callbacks fails, it will still attempt to unregister the rest. |
− | < | + | |
+ | See Also: [[#RegisterNativeEventCallback ( self, pfCallback )|RegisterNativeEventCallback]], [[#UnregisterNativeEventCallback ( self, uId )|UnregisterNativeEventCallback]] | ||
+ | |||
+ | ==== Parameters ==== | ||
+ | :'''kIds''' [IN] Collection of Windows message callback ids - integer list | ||
+ | |||
+ | ==== Returns ==== | ||
+ | :Success - RLPy.RStatus.Success | ||
+ | :Failure - RLPy.RStatus.Failure | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Define RWinMessageCallback 1 | ||
+ | class WinMessageCallback1(RLPy.RWinMessageCallback): | ||
+ | def __init__(self): | ||
+ | RLPy.RWinMessageCallback.__init__(self) | ||
+ | |||
+ | def OnWinMsgReceieved(self, data): | ||
+ | print("[WinMessageCallback1]window message received") | ||
− | + | # Define RWinMessageCallback 2 | |
+ | class WinMessageCallback2(RLPy.RWinMessageCallback): | ||
+ | def __init__(self): | ||
+ | RLPy.RWinMessageCallback.__init__(self) | ||
+ | |||
+ | def OnWinMsgReceieved(self, data): | ||
+ | print("[WinMessageCallback2]window message received2") | ||
− | + | # Unregister RIDockWidget native event callbacks | |
− | + | rl_dockwidget = RLPy.RUi.CreateRDockWidget() | |
− | + | rl_dockwidget.SetWindowTitle("main_dockwidget") | |
− | === | + | native_event_callback_1 = WinMessageCallback1() |
− | + | dialog_register_id_1 = rl_dockwidget.RegisterNativeEventCallBack(native_event_callback_1) | |
− | + | native_event_callback_2 = WinMessageCallback2() | |
+ | dialog_register_id_2 = rl_dockwidget.RegisterNativeEventCallBack(native_event_callback_2) | ||
+ | event_handler_list = [] | ||
+ | event_handler_list.append(dialog_register_id_1) | ||
+ | event_handler_list.append(dialog_register_id_2) | ||
+ | result = rl_dockwidget.UnregisterNativeEventCallbacks(event_handler_list) | ||
+ | print(result) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === RegisterEventCallback ( self, pfCallback ) === | |
− | + | ||
− | ==== | + | |
− | + | ||
− | + | Register a [[IC_Python_API:RLPy_RDialogCallback|RDialogCallback]] to this dock widget and return its ID. | |
− | ''' | + | See Also: [[#UnregisterEventCallback ( self, uId )|UnregisterEventCallback]], [[#UnregisterEventCallbacks ( self, kIds )|UnregisterEventCallbacks]] |
− | + | ||
− | + | ==== Parameters ==== | |
− | === | + | :'''pfCallback''' [IN] The designated dialog callback object - [[IC_Python_API:RLPy_RDialogCallback|RDialogCallback]] |
− | <syntaxhighlight lang=" | + | |
− | RLPy. | + | ==== Returns ==== |
+ | :The ID of the registered [[IC_Python_API:RLPy_RDialogCallback|RDialogCallback]] - integer | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Define RDialogCallback | ||
+ | class DialogEventCallback(RLPy.RDialogCallback): | ||
+ | def __init__(self): | ||
+ | RLPy.RDialogCallback.__init__(self) | ||
+ | |||
+ | def OnDialogShow(self): | ||
+ | print("dialog show") | ||
+ | |||
+ | def OnDialogHide(self): | ||
+ | print("dialog hide") | ||
+ | |||
+ | def OnDialogClose(self): | ||
+ | print("dialog close") | ||
+ | return True | ||
+ | |||
+ | # Register RIDockWidget event callback | ||
+ | rl_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | rl_dockwidget.SetWindowTitle("main_dockwidget") | ||
+ | dialog_event_callback = DialogEventCallback() | ||
+ | dialog_register_id = rl_dockwidget.RegisterEventCallBack(dialog_event_callback) | ||
+ | print(dialog_register_id) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === UnregisterEventCallback ( self, uId ) === | |
− | + | ||
− | ==== | + | |
− | + | ||
− | + | Unregister a [[IC_Python_API:RLPy_RDialogCallback|RDialogCallback]] from this dock widget. | |
− | '''RLPy.RStatus.Failure''' | + | See Also: [[#RegisterEventCallback ( self, pfCallback )|RegisterEventCallback]], [[#UnregisterEventCallbacks ( self, kIds )|UnregisterEventCallbacks]] |
− | </ | + | |
+ | ==== Parameters ==== | ||
+ | :'''uId''' [IN] ID of the callback for unregistering - integer | ||
+ | |||
+ | ==== Returns ==== | ||
+ | :Success - RLPy.RStatus.Success | ||
+ | :Failure - RLPy.RStatus.Failure | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Define RDialogCallback | ||
+ | class DialogEventCallback(RLPy.RDialogCallback): | ||
+ | def __init__(self): | ||
+ | RLPy.RDialogCallback.__init__(self) | ||
+ | |||
+ | def OnDialogShow(self): | ||
+ | print("dialog show") | ||
+ | |||
+ | def OnDialogHide(self): | ||
+ | print("dialog hide") | ||
+ | |||
+ | def OnDialogClose(self): | ||
+ | print("dialog close") | ||
+ | return True | ||
+ | |||
+ | # Unregister RIDockWidget event callback | ||
+ | rl_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | rl_dockwidget.SetWindowTitle("main_dockwidget") | ||
+ | dialog_event_callback = DialogEventCallback() | ||
+ | dialog_register_id = rl_dialog.RegisterEventCallBack(dialog_event_callback) | ||
+ | result = rl_dockwidget.UnregisterEventCallback(dialog_register_id) | ||
+ | print(result) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | === UnregisterEventCallbacks ( self, kIds ) === | ||
+ | |||
+ | Unregister a collection of [[IC_Python_API:RLPy_RDialogCallback|RDialogCallback]] from this dock widget. If unregistration of one of the callbacks fails, it will still attempt to unregister the rest. | ||
+ | |||
+ | See Also: [[#RegisterEventCallback ( self, pfCallback )|RegisterEventCallback]], [[#UnregisterEventCallback ( self, uId )|UnregisterEventCallback]], [[#UnregisterEventCallbacks ( self, kIds )|UnregisterEventCallbacks]] | ||
+ | |||
+ | ==== Parameters ==== | ||
+ | :'''kIds''' [IN] Collection of dialog callback ids for unregistering - integer list | ||
+ | |||
+ | ==== Returns ==== | ||
+ | :Success - RLPy.RStatus.Success | ||
+ | :Failure - RLPy.RStatus.Failure | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Define RDialogCallback 1 | ||
+ | class DialogEventCallback1(RLPy.RDialogCallback): | ||
+ | def __init__(self): | ||
+ | RLPy.RDialogCallback.__init__(self) | ||
+ | |||
+ | def OnDialogShow(self): | ||
+ | print("[DialogEventCallback1]dialog show") | ||
+ | |||
+ | def OnDialogHide(self): | ||
+ | print("[DialogEventCallback1]dialog hide") | ||
+ | |||
+ | def OnDialogClose(self): | ||
+ | print("[DialogEventCallback1]dialog close") | ||
+ | return True | ||
+ | |||
+ | # Define RDialogCallback 2 | ||
+ | class DialogEventCallback2(RLPy.RDialogCallback): | ||
+ | def __init__(self): | ||
+ | RLPy.RDialogCallback.__init__(self) | ||
+ | |||
+ | def OnDialogShow(self): | ||
+ | print("[DialogEventCallback2]dialog show") | ||
+ | |||
+ | def OnDialogHide(self): | ||
+ | print("[DialogEventCallback2]dialog hide") | ||
+ | |||
+ | def OnDialogClose(self): | ||
+ | print("[DialogEventCallback2]dialog close") | ||
+ | return True | ||
+ | |||
+ | # Unregister RIDockWidget event callback | ||
+ | rl_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | rl_dockwidget.SetWindowTitle("main_dockwidget") | ||
+ | dialog_event_callback_1 = DialogEventCallback1() | ||
+ | dialog_register_id_1 = rl_dockwidget.RegisterEventCallBack(dialog_event_callback_1) | ||
+ | dialog_event_callback_2 = DialogEventCallback2() | ||
+ | dialog_register_id_2 = rl_dockwidget.RegisterEventCallBack(dialog_event_callback_2) | ||
+ | event_handler_list = [] | ||
+ | event_handler_list.append(dialog_register_id_1) | ||
+ | event_handler_list.append(dialog_register_id_2) | ||
+ | result = rl_dockwidget.UnregisterEventCallbacks(event_handler_list) | ||
+ | print(result) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | === UnregisterAllEventCallbacks ( self ) === | ||
+ | |||
+ | Unregister all [[IC_Python_API:RLPy_RDialogCallback|RDialogCallback]] on this dock widget | ||
+ | |||
+ | See Also: [[#RegisterEventCallback ( self, pfCallback )|RegisterEventCallback]], [[#UnregisterEventCallback ( self, uId )|UnregisterEventCallback]], [[#UnregisterEventCallbacks ( self, kIds )|UnregisterEventCallbacks]] | ||
+ | |||
+ | ==== Returns ==== | ||
+ | :Success - RLPy.RStatus.Success | ||
+ | :Failure - RLPy.RStatus.Failure | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Define RDialogCallback 1 | ||
+ | class DialogEventCallback1(RLPy.RDialogCallback): | ||
+ | def __init__(self): | ||
+ | RLPy.RDialogCallback.__init__(self) | ||
+ | |||
+ | def OnDialogShow(self): | ||
+ | print("[DialogEventCallback1]dialog show") | ||
+ | |||
+ | def OnDialogHide(self): | ||
+ | print("[DialogEventCallback1]dialog hide") | ||
+ | |||
+ | def OnDialogClose(self): | ||
+ | print("[DialogEventCallback1]dialog close") | ||
+ | return True | ||
+ | |||
+ | # Define RDialogCallback 2 | ||
+ | class DialogEventCallback2(RLPy.RDialogCallback): | ||
+ | def __init__(self): | ||
+ | RLPy.RDialogCallback.__init__(self) | ||
+ | |||
+ | def OnDialogShow(self): | ||
+ | print("[DialogEventCallback2]dialog show") | ||
+ | |||
+ | def OnDialogHide(self): | ||
+ | print("[DialogEventCallback2]dialog hide") | ||
+ | |||
+ | def OnDialogClose(self): | ||
+ | print("[DialogEventCallback2]dialog close") | ||
+ | return True | ||
+ | |||
+ | # unregister RIDockWidget event callback | ||
+ | rl_dockwidget = RLPy.RUi.CreateRDockWidget() | ||
+ | rl_dockwidget.SetWindowTitle("main_dockwidget") | ||
+ | dialog_event_callback_1 = DialogEventCallback1() | ||
+ | dialog_register_id_1 = rl_dockwidget.RegisterEventCallBack(dialog_event_callback_1) | ||
+ | dialog_event_callback_2 = DialogEventCallback2() | ||
+ | dialog_register_id_2 = rl_dockwidget.RegisterEventCallBack(dialog_event_callback_2) | ||
+ | result = rl_dockwidget.UnregisterAllEventCallbacks() | ||
+ | print(result) | ||
+ | </syntaxhighlight> |
Latest revision as of 20:22, 13 May 2020
Contents
- 1 Description
- 2 Member Functions
- 2.1 GetWindow ( self )
- 2.2 GetTitle ( self )
- 2.3 GetWindowTitle ( self )
- 2.4 SetWindowTitle ( self, strTitleName )
- 2.5 SetWidget ( self, pWidget )
- 2.6 SetParent ( self, pWidget )
- 2.7 Show ( self )
- 2.8 Hide ( self )
- 2.9 Close ( self )
- 2.10 IsVisible ( self )
- 2.11 SetAllowedAreas ( self, eArea )
- 2.12 SetFloating ( self, bFloating )
- 2.13 SetFeatures ( self, eFeatures )
- 2.14 Features ( self )
- 2.15 IsAreaAllowed ( self, eArea )
- 2.16 IsFloating ( self )
- 2.17 RegisterNativeEventCallback ( self, pfCallback )
- 2.18 UnregisterNativeEventCallback ( self, uId )
- 2.19 UnregisterNativeEventCallbacks ( self, kIds )
- 2.20 RegisterEventCallback ( self, pfCallback )
- 2.21 UnregisterEventCallback ( self, uId )
- 2.22 UnregisterEventCallbacks ( self, kIds )
- 2.23 UnregisterAllEventCallbacks ( self )
- Main article: Modules.
- Last modified: 05/13/2020
Description
Provides dock widget related functions such as creating dock widgets and dock-able window related properties. It also allows the registration and unregistration of dock widget callback events.
Member Functions
GetWindow ( self )
Get the QWidget address of this dock widget, which can be used to create a PySide representation and later accomodate a Qt ui or qml file.
Returns
- The QWidget address for this dock widget - QWidget address
1 # Get RIDockWidget QWidget address and add view to the dockwidget
2 main_dockwidget_url = QUrl("...ui path")
3 main_dockwidget_view = PySide2.QtQuick.QQuickView()
4 main_dockwidget_view.setSource(main_dockwidget_url)
5
6 main_dockwidget = RLPy.RUi.CreateRDockWidget()
7 main_pyside_dockwidget = wrapInstance(int(main_dockwidget.GetWindow()), PySide2.QtWidgets.QDockWidget)
8 main_pyside_dockwidget.setObjectName("Main DockWidget")
9 main_dockwidget_container = main_pyside_dockwidget.createWindowContainer(main_dockwidget_view)
10 main_dockwidget_container.setMinimumWidth(main_dockwidget_view.width())
11 main_dockwidget_container.setMinimumHeight(main_dockwidget_view.height())
12 main_pyside_dockwidget.setWidget(main_dockwidget_container)
GetTitle ( self )
Get the QWidget address of this dock widget's title-bar, which can be used to deploy PySide operations.
Returns
- The QWidget address of this dock widget's title-bar - QWidget address
1 # Get RIDockWidget titlebar QWidget address
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget_title_bar_widget = wrapInstance(int(main_dockwidget.GetTitle()), PySide2.QtWidgets.QWidget)
GetWindowTitle ( self )
Get this dock widget's title-bar label text.
See Also: SetWindowTitle
Returns
- This dock widget's title text - string
1 # Get RIDockWidget titlebar text
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget_window_title = main_dockwidget.GetWindowTitle()
4 print(main_dockwidget_window_title)
SetWindowTitle ( self, strTitleName )
Set the label text for this dock widget's title-bar.
Parameters
- strTitleName [IN] Label text for the title-bar - string
1 # Set RIDockWidget titlebar text
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget.SetWindowTitle("Main Dockwidget")
SetWidget ( self, pWidget )
Insert another widget into this dock widget, by way of its window address, into this dock widget.
Parameters
- pWidget [IN] The insert widget's window address.
1 # Set RIDockWidget widget window address
2 main_rl_dlg = RLPy.RUi.CreateRDialog()
3 main_dockwidget = RLPy.RUi.CreateRDockWidget()
4 main_dockwidget.SetWidget(main_rl_dlg.GetWindow())
SetParent ( self, pWidget )
Set the parent widget for this dock widget according to its window address. Currently, the main window is the only viable option as the parent widget.
Parameters
- pWidget [IN] Parent widget's window address.
1 # Set RIDockWidget parent window address
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget.SetParent(RLPy.RUi.GetMainWindow())
Show ( self )
Make this dock widget visible.
1 # Show RIDockWidget
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget.SetWindowTitle("Main Dockwidget")
4 main_dockwidget.Show()
Hide ( self )
Hide this dock widget, but keep it in system memory.
1 # Hide RIDockWidget
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget.SetWindowTitle("Main Dockwidget")
4 main_dockwidget.Show()
5 main_dockwidget.Hide()
Close ( self )
Close this dock widget and release it from system memory.
1 # Close RIDockWidget
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget.SetWindowTitle("Main Dockwidget")
4 main_dockwidget.Show()
5 main_dockwidget.Close()
IsVisible ( self )
Check whether if this dock widget is visible or not.
Returns
- Visibility state of this dock widget - boolean
1 # Is RIDockWidget visible
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget.SetWindowTitle("Main Dockwidget")
4 rl_dockwidget.Show()
5 is_dockwidget_visible = main_dockwidget.IsVisible()
6 print(is_dockwidget_visible)
SetAllowedAreas ( self, eArea )
Set the dockable areas for this dock widget. Bit-wise operations can be used to combine and exclude different dock-able areas
See Also: IsAreaAllowed
Parameters
- eArea [IN] The dock-able areas for this dock widget - RLPy.EDockWidgetAreas
1 # Set RIDockWidget allowed area
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget.SetWindowTitle("Main Dockwidget")
4 main_dockwidget.SetAllowedAreas(RLPy.EDockWidgetAreas_LeftDockWidgetArea)
5 main_dockwidget.Show()
SetFloating ( self, bFloating )
Set the floating state of this dock widget. Currently, only a value of True takes effect.
See Also: IsFloating
Parameters
- bFloating [IN] The float state for this dock widget - boolean
1 # Set RIDockWidget floating status
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget.SetWindowTitle("Main Dockwidget")
4 main_dockwidget.SetFloating(True)
5 main_dockwidget.Show()
SetFeatures ( self, eFeatures )
Allow this dock widget to be movable, closable, and floatable. The feature parameter can be treated with bit-wise operations. The available RLPy.EDockWidgetFeatures match those inside PySide2.QtCore.Qt.
See Also: Features
Parameters
- eFeatures [IN] Features flags to be applied to this dock widget - RLPy.EDockWidgetFeatures
1 # Set RIDockWidget [[#Features ( self )|Features]]
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget.SetWindowTitle("Main Dockwidget")
4 main_dockwidget.SetFeatures(RLPy.EDockWidgetFeatures_Movable)
5 main_dockwidget.Show()
Features ( self )
Get all of the feature flags applied to this dock widget.
See also: SetFeatures
Returns
- All feature flags on this dock widget - RLPy.EDockWidgetFeatures
1 # Get RIDockWidget [[#Features ( self )|Features]]
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget.SetWindowTitle("Main Dockwidget")
4 main_dockwidget.SetFeatures(RLPy.EDockWidgetFeatures_Movable)
5 main_dockwidget.Show()
6 features = rl_dockwidget.Features()
7 print(features)
IsAreaAllowed ( self, eArea )
Check if this dock widget can be docked into a certain region of the application.
See Also: SetAllowedAreas
Returns
- returns True if this dock widget can dock with the region in question, else False - boolean
1 # Is RIDockWidget area allowed
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget.SetWindowTitle("Main Dockwidget")
4 main_dockwidget.SetAllowedAreas(RLPy.EDockWidgetAreas_LeftDockWidgetArea)
5 main_dockwidget.Show()
6 is_dockwidget_area_allowed = main_dockwidget.IsAreaAllowed(RLPy.EDockWidgetAreas_LeftDockWidgetArea)
7 print(is_dockwidget_area_allowed)
IsFloating ( self )
Check if this dock widget is floating (not docked to the application's main window).
See also: SetFloating
Returns
- Floating status of this dock widget - boolean
1 # Get RIDockWidget floating status
2 main_dockwidget = RLPy.RUi.CreateRDockWidget()
3 main_dockwidget.SetWindowTitle("Main Dockwidget")
4 main_dockwidget.Show()
5 is_dockwidget_floating = main_dockwidget.IsFloating()
6 print(is_dockwidget_floating)
RegisterNativeEventCallback ( self, pfCallback )
Register a RWinMessageCallback with this dock widget and returns its ID.
See Also: UnregisterNativeEventCallback, UnregisterNativeEventCallbacks
Parameters
- pfCallback [IN] The Windows message callback for registration - RWinMessageCallback
Returns
- ID of the unregsitered RWinMessageCallback - integer
1 # Define RWinMessageCallback
2 class WinMessageCallback(RLPy.RWinMessageCallback):
3 def __init__(self):
4 RLPy.RWinMessageCallback.__init__(self)
5
6 def OnWinMsgReceieved(self, data):
7 print("window message received")
8
9 # Register RIDockWidget native event callback
10 rl_dockwidget = RLPy.RUi.CreateRDockWidget()
11 rl_dockwidget.SetWindowTitle("main_dockwidget")
12 native_event_callback = WinMessageCallback()
13 dialog_register_id = rl_dockwidget.RegisterNativeEventCallBack(native_event_callback)
14 print(dialog_register_id)
UnregisterNativeEventCallback ( self, uId )
Unregister a RWinMessageCallback from this dock widget.
See Also: RegisterNativeEventCallback, UnregisterNativeEventCallbacks
Parameters
- uId [IN] ID of the unregisterd RWinMessageCallback - integer
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # Define RWinMessageCallback
2 class WinMessageCallback(RLPy.RWinMessageCallback):
3 def __init__(self):
4 RLPy.RWinMessageCallback.__init__(self)
5
6 def OnWinMsgReceieved(self, data):
7 print("window message received")
8
9 # Unregister RIDockWidget native event callback
10 rl_dockwidget = RLPy.RUi.CreateRDockWidget()
11 rl_dockwidget.SetWindowTitle("main_dockwidget")
12 native_event_callback = WinMessageCallback()
13 dialog_register_id = rl_dialog.RegisterNativeEventCallBack(native_event_callback)
14 result = rl_dockwidget.UnregisterNativeEventCallback(dialog_register_id)
15 print(result)
UnregisterNativeEventCallbacks ( self, kIds )
Unregister a collection of RWinMessageCallback from this dock widget. If unregistration of one of the callbacks fails, it will still attempt to unregister the rest.
See Also: RegisterNativeEventCallback, UnregisterNativeEventCallback
Parameters
- kIds [IN] Collection of Windows message callback ids - integer list
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # Define RWinMessageCallback 1
2 class WinMessageCallback1(RLPy.RWinMessageCallback):
3 def __init__(self):
4 RLPy.RWinMessageCallback.__init__(self)
5
6 def OnWinMsgReceieved(self, data):
7 print("[WinMessageCallback1]window message received")
8
9 # Define RWinMessageCallback 2
10 class WinMessageCallback2(RLPy.RWinMessageCallback):
11 def __init__(self):
12 RLPy.RWinMessageCallback.__init__(self)
13
14 def OnWinMsgReceieved(self, data):
15 print("[WinMessageCallback2]window message received2")
16
17 # Unregister RIDockWidget native event callbacks
18 rl_dockwidget = RLPy.RUi.CreateRDockWidget()
19 rl_dockwidget.SetWindowTitle("main_dockwidget")
20 native_event_callback_1 = WinMessageCallback1()
21 dialog_register_id_1 = rl_dockwidget.RegisterNativeEventCallBack(native_event_callback_1)
22 native_event_callback_2 = WinMessageCallback2()
23 dialog_register_id_2 = rl_dockwidget.RegisterNativeEventCallBack(native_event_callback_2)
24 event_handler_list = []
25 event_handler_list.append(dialog_register_id_1)
26 event_handler_list.append(dialog_register_id_2)
27 result = rl_dockwidget.UnregisterNativeEventCallbacks(event_handler_list)
28 print(result)
RegisterEventCallback ( self, pfCallback )
Register a RDialogCallback to this dock widget and return its ID.
See Also: UnregisterEventCallback, UnregisterEventCallbacks
Parameters
- pfCallback [IN] The designated dialog callback object - RDialogCallback
Returns
- The ID of the registered RDialogCallback - integer
1 # Define RDialogCallback
2 class DialogEventCallback(RLPy.RDialogCallback):
3 def __init__(self):
4 RLPy.RDialogCallback.__init__(self)
5
6 def OnDialogShow(self):
7 print("dialog show")
8
9 def OnDialogHide(self):
10 print("dialog hide")
11
12 def OnDialogClose(self):
13 print("dialog close")
14 return True
15
16 # Register RIDockWidget event callback
17 rl_dockwidget = RLPy.RUi.CreateRDockWidget()
18 rl_dockwidget.SetWindowTitle("main_dockwidget")
19 dialog_event_callback = DialogEventCallback()
20 dialog_register_id = rl_dockwidget.RegisterEventCallBack(dialog_event_callback)
21 print(dialog_register_id)
UnregisterEventCallback ( self, uId )
Unregister a RDialogCallback from this dock widget.
See Also: RegisterEventCallback, UnregisterEventCallbacks
Parameters
- uId [IN] ID of the callback for unregistering - integer
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # Define RDialogCallback
2 class DialogEventCallback(RLPy.RDialogCallback):
3 def __init__(self):
4 RLPy.RDialogCallback.__init__(self)
5
6 def OnDialogShow(self):
7 print("dialog show")
8
9 def OnDialogHide(self):
10 print("dialog hide")
11
12 def OnDialogClose(self):
13 print("dialog close")
14 return True
15
16 # Unregister RIDockWidget event callback
17 rl_dockwidget = RLPy.RUi.CreateRDockWidget()
18 rl_dockwidget.SetWindowTitle("main_dockwidget")
19 dialog_event_callback = DialogEventCallback()
20 dialog_register_id = rl_dialog.RegisterEventCallBack(dialog_event_callback)
21 result = rl_dockwidget.UnregisterEventCallback(dialog_register_id)
22 print(result)
UnregisterEventCallbacks ( self, kIds )
Unregister a collection of RDialogCallback from this dock widget. If unregistration of one of the callbacks fails, it will still attempt to unregister the rest.
See Also: RegisterEventCallback, UnregisterEventCallback, UnregisterEventCallbacks
Parameters
- kIds [IN] Collection of dialog callback ids for unregistering - integer list
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # Define RDialogCallback 1
2 class DialogEventCallback1(RLPy.RDialogCallback):
3 def __init__(self):
4 RLPy.RDialogCallback.__init__(self)
5
6 def OnDialogShow(self):
7 print("[DialogEventCallback1]dialog show")
8
9 def OnDialogHide(self):
10 print("[DialogEventCallback1]dialog hide")
11
12 def OnDialogClose(self):
13 print("[DialogEventCallback1]dialog close")
14 return True
15
16 # Define RDialogCallback 2
17 class DialogEventCallback2(RLPy.RDialogCallback):
18 def __init__(self):
19 RLPy.RDialogCallback.__init__(self)
20
21 def OnDialogShow(self):
22 print("[DialogEventCallback2]dialog show")
23
24 def OnDialogHide(self):
25 print("[DialogEventCallback2]dialog hide")
26
27 def OnDialogClose(self):
28 print("[DialogEventCallback2]dialog close")
29 return True
30
31 # Unregister RIDockWidget event callback
32 rl_dockwidget = RLPy.RUi.CreateRDockWidget()
33 rl_dockwidget.SetWindowTitle("main_dockwidget")
34 dialog_event_callback_1 = DialogEventCallback1()
35 dialog_register_id_1 = rl_dockwidget.RegisterEventCallBack(dialog_event_callback_1)
36 dialog_event_callback_2 = DialogEventCallback2()
37 dialog_register_id_2 = rl_dockwidget.RegisterEventCallBack(dialog_event_callback_2)
38 event_handler_list = []
39 event_handler_list.append(dialog_register_id_1)
40 event_handler_list.append(dialog_register_id_2)
41 result = rl_dockwidget.UnregisterEventCallbacks(event_handler_list)
42 print(result)
UnregisterAllEventCallbacks ( self )
Unregister all RDialogCallback on this dock widget
See Also: RegisterEventCallback, UnregisterEventCallback, UnregisterEventCallbacks
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # Define RDialogCallback 1
2 class DialogEventCallback1(RLPy.RDialogCallback):
3 def __init__(self):
4 RLPy.RDialogCallback.__init__(self)
5
6 def OnDialogShow(self):
7 print("[DialogEventCallback1]dialog show")
8
9 def OnDialogHide(self):
10 print("[DialogEventCallback1]dialog hide")
11
12 def OnDialogClose(self):
13 print("[DialogEventCallback1]dialog close")
14 return True
15
16 # Define RDialogCallback 2
17 class DialogEventCallback2(RLPy.RDialogCallback):
18 def __init__(self):
19 RLPy.RDialogCallback.__init__(self)
20
21 def OnDialogShow(self):
22 print("[DialogEventCallback2]dialog show")
23
24 def OnDialogHide(self):
25 print("[DialogEventCallback2]dialog hide")
26
27 def OnDialogClose(self):
28 print("[DialogEventCallback2]dialog close")
29 return True
30
31 # unregister RIDockWidget event callback
32 rl_dockwidget = RLPy.RUi.CreateRDockWidget()
33 rl_dockwidget.SetWindowTitle("main_dockwidget")
34 dialog_event_callback_1 = DialogEventCallback1()
35 dialog_register_id_1 = rl_dockwidget.RegisterEventCallBack(dialog_event_callback_1)
36 dialog_event_callback_2 = DialogEventCallback2()
37 dialog_register_id_2 = rl_dockwidget.RegisterEventCallBack(dialog_event_callback_2)
38 result = rl_dockwidget.UnregisterAllEventCallbacks()
39 print(result)