IC Python API:RLPy RIDockWidget

From Reallusion Wiki!
Jump to: navigation, search
Main article: Modules.

Detailed Description

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.
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
  
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
dialog_event_callback = DialogEventCallback()
dialog_register_id = rl_DockWidget.RegisterEventCallBack(dialog_event_callback)

# use id to unregister
rl_DockWidget.UnregisterEventCallback(dialog_register_id)

rl_DockWidget.Show()
rl_DockWidget.IsVisble() # True
rl_DockWidget.Hide()
rl_DockWidget.IsVisble() # False

Member Functions

Features

RLPy.RIDockWidget.Features ( self )

Return the DockWidget is movable, closable, and floatable.

Returns

DockWidget features - RLPy.EDockWidgetFeatures
  • RLPy.EDockWidgetFeatures_NoFeatures
  • RLPy.EDockWidgetFeatures_Closable
  • RLPy.EDockWidgetFeatures_Movable
  • RLPy.EDockWidgetFeatures_Floatable
  • RLPy.EDockWidgetFeatures_VerticalTitleBar
  • RLPy.EDockWidgetFeatures_AllFeatures

GetTitle

RLPy.RIDockWidget.GetTitle ( self )

Get title bar widget's address.

Returns

Address of the title bar widget - QWidget

GetWindow

RLPy.RIDockWidget.GetWindow ( self )

Get DockWidget's itself address.

Returns

A pointer to the DockWidget - QWidget

GetWindowTitle

RLPy.RIDockWidget.GetWindowTitle ( self )

Get title bar name.

Returns

Title bar name - string

IsAreaAllowed

RLPy.RIDockWidget.IsAreaAllowed ( self, eArea )

Return true if this area can place, otherwise return false.

Parameters

eArea [IN] DockWidget area - RLPy.EDockWidgetAreas

  • RLPy.EDockWidgetAreas_NoDockwidgetArea
  • RLPy.EDockWidgetAreas_LeftDockWidgetArea
  • RLPy.EDockWidgetAreas_RightDockWidgetArea
  • RLPy.EDockWidgetAreas_TopDockWidgetArea
  • RLPy.EDockWidgetAreas_BottomDockWidgetArea
  • RLPy.EDockWidgetAreas_AllFeatures

Returns

True if area allows or False if area doesn't allow - bool

IsFloating

RLPy.RIDockWidget.IsFloating ( self )

Return the dock widget is floating or not.

Returns

True or False - bool

RegisterEventCallback

RLPy.RIDockWidget.RegisterEventCallback ( self, pfCallback )

Dialog event callback.

Parameters

pfCallback [IN] dialog event callback pointer - RLPy.RDialogCallback

Returns

Dialog event callBack id - int

RegisterNativeEventCallback

RLPy.RIDockWidget.RegisterNativeEventCallback ( self, pfCallback )

Windows event callback.

Parameters

pfCallback [IN] Window message callback pointer - RLPy.RWinMessageCallback

Returns

Windows Event callBack id - int

SetAllowedAreas

RLPy.RIDockWidget.SetAllowedAreas ( self, eArea )

Set areas where the DockWidget may be placed.

Parameters

eArea [IN] allow area - RLPy.EDockWidgetAreas

  • RLPy.EDockWidgetAreas_NoDockwidgetArea
  • RLPy.EDockWidgetAreas_LeftDockWidgetArea
  • RLPy.EDockWidgetAreas_RightDockWidgetArea
  • RLPy.EDockWidgetAreas_TopDockWidgetArea
  • RLPy.EDockWidgetAreas_BottomDockWidgetArea
  • RLPy.EDockWidgetAreas_AllFeatures

SetFeatures

RLPy.RIDockWidget.SetFeatures ( self, eFeatures )

Set the DockWidget is movable, closable, and floatable.

Parameters

eFeature [IN] feature


SetFloating

RLPy.RIDockWidget.SetFloating ( self, bFloating )

Set the DockWidget is floating.

Parameters

bFloating [IN] floating - bool


SetParent

RLPy.RIDockWidget.SetParent ( self, pWidget )

Set the parent of the DockWidget.

Parameters

pWidget [IN] Widget pointer - QWidget


SetWidget

RLPy.RIDockWidget.SetWidget ( self, pWidget )

Set the widget for the DockWidget.

Parameters

pWidget [IN] a pointer to the widget - QWidget


SetWindowTitle

RLPy.RIDockWidget.SetWindowTitle ( self, strTitleName )

Set DockWidget title name.

Parameters

strTitleName [IN] title name - string


UnregisterAllEventCallbacks

RLPy.RIDockWidget.UnregisterAllEventCallbacks ( self )

Unregister all dialog event callback.

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


UnregisterEventCallback

RLPy.RIDockWidget.UnregisterEventCallback ( self, uId )

Unregister dialog event callback.

Parameters

uId [IN] callback id - int

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


UnregisterEventCallbacks

RLPy.RIDockWidget.UnregisterEventCallbacks ( self, kIds )

Unregister dialog event callback with Ids.

Parameters

kIds [IN] callback ids - int

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


UnregisterNativeEventCallback

RLPy.RIDockWidget.UnregisterNativeEventCallback ( self, uId )

Unregister windows event callback with Id.

Parameters

uId [IN] callback id - int

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail


UnregisterNativeEventCallbacks

RLPy.RIDockWidget.UnregisterNativeEventCallbacks ( self, kIds )

Unregister windows event callback with Ids.

Parameters

kIds [IN] callback ids - int

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail