Difference between revisions of "IC Python API:RLPy RIDockWidget"

From Reallusion Wiki!
Jump to: navigation, search
(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...")
 
m
 
Line 1: Line 1:
 
{{TOC}}
 
{{TOC}}
 
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
 
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
==Detailed Description==
+
{{last_modified}}
This class is custom dock widget.
+
This class provides a widget that can be docked inside a QMainWindow or floated as a top-level window on the desktop. <syntaxhighlight lang="Python">
+
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):
+
== Description ==
   print("dialog close")
+
   return True
+
  
+
rl_DockWidget = RLPy.RUi.CreateRDockWidget()
+
rl_DockWidget.SetWindowTitle("main_dialog")
+
print(rl_DockWidget.GetWindowTitle()) # main_dialog
+
rl_DockWidget.SetAllowedAreas(RLPy.EDockWidgetAreas_LeftDockWidgetArea)
+
#rl_DockWidget.SetAllowedAreas(int(PySide2.QtCore.Qt.LeftDockWidgetArea)) can also use this
+
rl_DockWidget.SetFloating(True)
+
rl_DockWidget.SetFeatures(RLPy.EDockWidgetFeatures_Movable)
+
#rl_dockwidget.SetFeatures(int(PySide2.QtWidgets.QDockWidget.DockWidgetMovable)) can also use this
+
  
# register dialog event
+
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.
dialog_event_callback = DialogEventCallback()
+
 
dialog_register_id = rl_DockWidget.RegisterEventCallBack(dialog_event_callback)
+
== 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
  
# use id to unregister
+
<syntaxhighlight lang="python" line='line'>
rl_DockWidget.UnregisterEventCallback(dialog_register_id)
+
# 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)
  
rl_DockWidget.Show()
+
main_dockwidget = RLPy.RUi.CreateRDockWidget()
rl_DockWidget.IsVisble() # True
+
main_pyside_dockwidget = wrapInstance(int(main_dockwidget.GetWindow()), PySide2.QtWidgets.QDockWidget)
rl_DockWidget.Hide()
+
main_pyside_dockwidget.setObjectName("Main DockWidget")
rl_DockWidget.IsVisble() # False
+
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>
==Member Functions==
+
 
===Features===
+
=== GetTitle ( self ) ===
<syntaxhighlight lang="Python">
+
 
RLPy.RIDockWidget.Features ( 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
 +
 
 +
<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>
Return the DockWidget is movable, closable, and floatable.
+
 
====Returns====
+
=== GetWindowTitle ( self ) ===
<div style="margin-left: 2em;">DockWidget features - RLPy.EDockWidgetFeatures
+
 
*'''RLPy.EDockWidgetFeatures_NoFeatures'''
+
Get this dock widget's title-bar label text.
*'''RLPy.EDockWidgetFeatures_Closable'''
+
 
*'''RLPy.EDockWidgetFeatures_Movable'''
+
See Also: [[#SetWindowTitle ( self, strTitleName )|SetWindowTitle]]
*'''RLPy.EDockWidgetFeatures_Floatable'''
+
 
*'''RLPy.EDockWidgetFeatures_VerticalTitleBar'''
+
==== Returns ====
*'''RLPy.EDockWidgetFeatures_AllFeatures'''
+
:This dock widget's title text - string
</div>
+
 
-----
+
<syntaxhighlight lang="python" line='line'>
===GetTitle===
+
# Get RIDockWidget titlebar text
<syntaxhighlight lang="Python">
+
main_dockwidget = RLPy.RUi.CreateRDockWidget()
RLPy.RIDockWidget.GetTitle ( self )
+
main_dockwidget_window_title = main_dockwidget.GetWindowTitle()
 +
print(main_dockwidget_window_title)
 
</syntaxhighlight>
 
</syntaxhighlight>
Get title bar widget's address.
+
 
====Returns====
+
=== SetWindowTitle ( self, strTitleName ) ===
<div style="margin-left: 2em;">Address of the title bar widget - QWidget
+
 
</div>
+
Set the label text for this dock widget's title-bar.
-----
+
 
===GetWindow===
+
==== Parameters ====
<syntaxhighlight lang="Python">
+
:'''strTitleName''' [IN] Label text for the title-bar - string
RLPy.RIDockWidget.GetWindow ( self )
+
 
 +
<syntaxhighlight lang="python" line='line'>
 +
# Set RIDockWidget titlebar text
 +
main_dockwidget = RLPy.RUi.CreateRDockWidget()
 +
main_dockwidget.SetWindowTitle("Main Dockwidget")
 
</syntaxhighlight>
 
</syntaxhighlight>
Get DockWidget's itself address.
+
 
====Returns====
+
=== SetWidget ( self, pWidget ) ===
<div style="margin-left: 2em;">A pointer to the DockWidget - QWidget
+
 
</div>
+
Insert another widget into this dock widget, by way of its window address, into this dock widget.
-----
+
 
===GetWindowTitle===
+
==== Parameters ====
<syntaxhighlight lang="Python">
+
:'''pWidget''' [IN] The insert widget's window address.
RLPy.RIDockWidget.GetWindowTitle ( self )
+
 
 +
<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>
Get title bar name.
+
 
====Returns====
+
=== SetParent ( self, pWidget ) ===
<div style="margin-left: 2em;">Title bar name - string
+
 
</div>
+
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.
-----
+
 
===IsAreaAllowed===
+
==== Parameters ====
<syntaxhighlight lang="Python">
+
:'''pWidget''' [IN] Parent widget's window address.
RLPy.RIDockWidget.IsAreaAllowed ( self, eArea )
+
 
 +
<syntaxhighlight lang="python" line='line'>
 +
# Set RIDockWidget parent window address
 +
main_dockwidget = RLPy.RUi.CreateRDockWidget()
 +
main_dockwidget.SetParent(RLPy.RUi.GetMainWindow())
 
</syntaxhighlight>
 
</syntaxhighlight>
Return true if this area can place, otherwise return false.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''eArea''' [IN] DockWidget area - RLPy.EDockWidgetAreas
+
=== Show ( self ) ===
*'''RLPy.EDockWidgetAreas_NoDockwidgetArea'''
+
 
*'''RLPy.EDockWidgetAreas_LeftDockWidgetArea'''
+
Make this dock widget visible.
*'''RLPy.EDockWidgetAreas_RightDockWidgetArea'''
+
 
*'''RLPy.EDockWidgetAreas_TopDockWidgetArea'''
+
See Also: [[#Hide ( self )|Hide]], [[#Close ( self )|Close]]
*'''RLPy.EDockWidgetAreas_BottomDockWidgetArea'''
+
 
*'''RLPy.EDockWidgetAreas_AllFeatures'''
+
<syntaxhighlight lang="python" line='line'>
</div>
+
# Show RIDockWidget
====Returns====
+
main_dockwidget = RLPy.RUi.CreateRDockWidget()
<div style="margin-left: 2em;">True if area allows or False if area doesn't allow - bool
+
main_dockwidget.SetWindowTitle("Main Dockwidget")
</div>
+
main_dockwidget.Show()
-----
+
===IsFloating===
+
<syntaxhighlight lang="Python">
+
RLPy.RIDockWidget.IsFloating ( self )
+
 
</syntaxhighlight>
 
</syntaxhighlight>
Return the dock widget is floating or not.
+
 
====Returns====
+
=== Hide ( self ) ===
<div style="margin-left: 2em;">True or False - bool
+
 
</div>
+
Hide this dock widget, but keep it in system memory.
-----
+
 
===RegisterEventCallback===
+
See Also: [[#Show ( self )|Show]], [[#Close ( self )|Close]]
<syntaxhighlight lang="Python">
+
 
RLPy.RIDockWidget.RegisterEventCallback ( self, pfCallback )
+
<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>
Dialog event callback.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''pfCallback''' [IN] dialog event callback pointer - RLPy.RDialogCallback
+
=== Close ( self ) ===
</div>
+
 
====Returns====
+
Close this dock widget and release it from system memory.
<div style="margin-left: 2em;">Dialog event callBack id - int
+
 
</div>
+
See Also: [[#Show ( self )|Show]], [[#Hide ( self )|Hide]]
-----
+
 
===RegisterNativeEventCallback===
+
<syntaxhighlight lang="python" line='line'>
<syntaxhighlight lang="Python">
+
# Close RIDockWidget
RLPy.RIDockWidget.RegisterNativeEventCallback ( self, pfCallback )
+
main_dockwidget = RLPy.RUi.CreateRDockWidget()
 +
main_dockwidget.SetWindowTitle("Main Dockwidget")
 +
main_dockwidget.Show()
 +
main_dockwidget.Close()
 
</syntaxhighlight>
 
</syntaxhighlight>
Windows event callback.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''pfCallback''' [IN] Window message callback pointer - RLPy.RWinMessageCallback
+
=== IsVisible ( self ) ===
</div>
+
 
====Returns====
+
Check whether if this dock widget is visible or not.
<div style="margin-left: 2em;">Windows Event callBack id - int
+
 
</div>
+
See Also: [[#Show ( self )|Show]], [[#Hide ( self )|Hide]], [[#Close ( self )|Close]]
-----
+
 
===SetAllowedAreas===
+
==== Returns ====
<syntaxhighlight lang="Python">
+
:Visibility state of this dock widget - boolean
RLPy.RIDockWidget.SetAllowedAreas ( self, eArea )
+
 
 +
<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>
Set areas where the DockWidget may be placed.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''eArea''' [IN] allow area - RLPy.EDockWidgetAreas
+
=== SetAllowedAreas ( self, eArea ) ===
*'''RLPy.EDockWidgetAreas_NoDockwidgetArea'''
+
 
*'''RLPy.EDockWidgetAreas_LeftDockWidgetArea'''
+
Set the dockable areas for this dock widget. Bit-wise operations can be used to combine and exclude different dock-able areas
*'''RLPy.EDockWidgetAreas_RightDockWidgetArea'''
+
 
*'''RLPy.EDockWidgetAreas_TopDockWidgetArea'''
+
See Also: [[#IsAreaAllowed ( self, eArea )|IsAreaAllowed]]
*'''RLPy.EDockWidgetAreas_BottomDockWidgetArea'''
+
 
*'''RLPy.EDockWidgetAreas_AllFeatures'''
+
==== Parameters ====
</div>
+
:'''eArea''' [IN] The dock-able areas for this dock widget - [[IC_Python_API:Enums#RLPy.EDockWidgetAreas|RLPy.EDockWidgetAreas]]
-----
+
 
===SetFeatures===
+
<syntaxhighlight lang="python" line='line'>
<syntaxhighlight lang="Python">
+
# Set RIDockWidget allowed area
RLPy.RIDockWidget.SetFeatures ( self, eFeatures )
+
main_dockwidget = RLPy.RUi.CreateRDockWidget()
 +
main_dockwidget.SetWindowTitle("Main Dockwidget")
 +
main_dockwidget.SetAllowedAreas(RLPy.EDockWidgetAreas_LeftDockWidgetArea)
 +
main_dockwidget.Show()
 
</syntaxhighlight>
 
</syntaxhighlight>
Set the DockWidget is movable, closable, and floatable.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''eFeature''' [IN] feature
+
=== SetFloating ( self, bFloating ) ===
</div>
+
 
-----
+
Set the floating state of this dock widget. Currently, only a value of '''True''' takes effect.
===SetFloating===
+
 
<syntaxhighlight lang="Python">
+
See Also: [[#IsFloating ( self )|IsFloating]]
RLPy.RIDockWidget.SetFloating ( self, bFloating )
+
 
 +
==== 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>
Set the DockWidget is floating.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''bFloating''' [IN] floating - bool
+
=== SetFeatures ( self, eFeatures ) ===
</div>
+
 
-----
+
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.
===SetParent===
+
 
<syntaxhighlight lang="Python">
+
See Also: [[#Features ( self )|Features]]
RLPy.RIDockWidget.SetParent ( self, pWidget )
+
 
 +
==== 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>
Set the parent of the DockWidget.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''pWidget''' [IN] Widget pointer - QWidget
+
=== Features ( self ) ===
</div>
+
 
-----
+
Get all of the feature flags applied to this dock widget.
===SetWidget===
+
 
<syntaxhighlight lang="Python">
+
See also: [[#SetFeatures ( self, eFeatures )|SetFeatures]]
RLPy.RIDockWidget.SetWidget ( self, pWidget )
+
 
 +
==== 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>
Set the widget for the DockWidget.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''pWidget''' [IN] a pointer to the widget - QWidget
+
=== IsAreaAllowed ( self, eArea ) ===
</div>
+
 
-----
+
Check if this dock widget can be docked into a certain region of the application.
===SetWindowTitle===
+
 
<syntaxhighlight lang="Python">
+
See Also: [[#SetAllowedAreas ( self, eArea )|SetAllowedAreas]]
RLPy.RIDockWidget.SetWindowTitle ( self, strTitleName )
+
 
 +
==== 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>
Set DockWidget title name.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''strTitleName''' [IN] title name - string
+
=== IsFloating ( self ) ===
</div>
+
 
-----
+
Check if this dock widget is floating (not docked to the application's main window).
===UnregisterAllEventCallbacks===
+
 
<syntaxhighlight lang="Python">
+
See also: [[#SetFloating ( self, bFloating )|SetFloating]]
RLPy.RIDockWidget.UnregisterAllEventCallbacks ( self )
+
 
 +
==== 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>
Unregister all dialog event callback.
 
====Return Values====
 
<div style="margin-left: 2em;">
 
  
'''RLPy.RStatus.Success''' Success
+
=== RegisterNativeEventCallback ( self, pfCallback ) ===
  
'''RLPy.RStatus.Failure''' Fail
+
Register a [[IC_Python_API:RLPy_RWinMessageCallback|RWinMessageCallback]] with this dock widget and returns its ID.
</div>
+
 
-----
+
See Also: [[#UnregisterNativeEventCallback ( self, uId )|UnregisterNativeEventCallback]], [[#UnregisterNativeEventCallbacks ( self, kIds )|UnregisterNativeEventCallbacks]]
===UnregisterEventCallback===
+
 
<syntaxhighlight lang="Python">
+
==== Parameters ====
RLPy.RIDockWidget.UnregisterEventCallback ( self, uId )
+
:'''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>
Unregister dialog event callback.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''uId''' [IN] callback id - int
+
=== UnregisterNativeEventCallback ( self, uId ) ===
</div>
+
====Return Values====
+
<div style="margin-left: 2em;">
+
  
'''RLPy.RStatus.Success''' Success
+
Unregister a [[IC_Python_API:RLPy_RWinMessageCallback|RWinMessageCallback]] from this dock widget.
  
'''RLPy.RStatus.Failure''' Fail
+
See Also: [[#RegisterNativeEventCallback ( self, pfCallback )|RegisterNativeEventCallback]], [[#UnregisterNativeEventCallbacks ( self, kIds )|UnregisterNativeEventCallbacks]]
</div>
+
 
-----
+
==== Parameters ====
===UnregisterEventCallbacks===
+
:'''uId''' [IN] ID of the unregisterd [[IC_Python_API:RLPy_RWinMessageCallback|RWinMessageCallback]] - integer
<syntaxhighlight lang="Python">
+
 
RLPy.RIDockWidget.UnregisterEventCallbacks ( self, kIds )
+
==== 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>
Unregister dialog event callback with Ids.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''kIds''' [IN] callback ids - int
+
=== UnregisterNativeEventCallbacks ( self, kIds ) ===
</div>
+
 
====Return Values====
+
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.
<div style="margin-left: 2em;">
+
 
 +
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")
  
'''RLPy.RStatus.Success''' Success
+
# Define RWinMessageCallback 2
 +
class WinMessageCallback2(RLPy.RWinMessageCallback):
 +
  def __init__(self):
 +
      RLPy.RWinMessageCallback.__init__(self)
 +
     
 +
  def OnWinMsgReceieved(self, data):
 +
      print("[WinMessageCallback2]window message received2")
  
'''RLPy.RStatus.Failure''' Fail
+
# Unregister RIDockWidget native event callbacks
</div>
+
rl_dockwidget = RLPy.RUi.CreateRDockWidget()
-----
+
rl_dockwidget.SetWindowTitle("main_dockwidget")
===UnregisterNativeEventCallback===
+
native_event_callback_1 = WinMessageCallback1()
<syntaxhighlight lang="Python">
+
dialog_register_id_1 = rl_dockwidget.RegisterNativeEventCallBack(native_event_callback_1)
RLPy.RIDockWidget.UnregisterNativeEventCallback ( self, uId )
+
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>
Unregister windows event callback with Id.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''uId''' [IN] callback id - int
+
=== RegisterEventCallback ( self, pfCallback ) ===
</div>
+
====Return Values====
+
<div style="margin-left: 2em;">
+
  
'''RLPy.RStatus.Success''' Success
+
Register a [[IC_Python_API:RLPy_RDialogCallback|RDialogCallback]] to this dock widget and return its ID.
  
'''RLPy.RStatus.Failure''' Fail
+
See Also: [[#UnregisterEventCallback ( self, uId )|UnregisterEventCallback]], [[#UnregisterEventCallbacks ( self, kIds )|UnregisterEventCallbacks]]
</div>
+
 
-----
+
==== Parameters ====
===UnregisterNativeEventCallbacks===
+
:'''pfCallback''' [IN] The designated dialog callback object - [[IC_Python_API:RLPy_RDialogCallback|RDialogCallback]]
<syntaxhighlight lang="Python">
+
 
RLPy.RIDockWidget.UnregisterNativeEventCallbacks ( self, kIds )
+
==== 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>
Unregister windows event callback with Ids.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''kIds''' [IN] callback ids - int
+
=== UnregisterEventCallback ( self, uId ) ===
</div>
+
====Return Values====
+
<div style="margin-left: 2em;">
+
  
'''RLPy.RStatus.Success''' Success
+
Unregister a [[IC_Python_API:RLPy_RDialogCallback|RDialogCallback]] from this dock widget.
  
'''RLPy.RStatus.Failure''' Fail
+
See Also: [[#RegisterEventCallback ( self, pfCallback )|RegisterEventCallback]], [[#UnregisterEventCallbacks ( self, kIds )|UnregisterEventCallbacks]]
</div>
+
 
 +
==== 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

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.

See Also: Hide, Close

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.

See Also: Show, Close

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.

See Also: Show, Hide

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.

See Also: Show, Hide, Close

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)