Customize The User Interface
The Rumba user interface is done with Qt 5 and Pyside 2.
You can simply access the different elements of the user interface and modify them or create new user interface elements.
Access the main Qt Widgets
Here is how you can access some of the main Qt widgets:
import rumbapy
main_window = rumbapy.widget("MainWindow")
main_viewport = rumbapy.widget("MainViewport")
See also
The rumbapy.widget() for more information.
Create a floating window
import rumbapy
from PySide2 import QtWidgets
main_window = rumbapy.widget("MainWindow")
window = QtWidgets.QMainWindow(main_window)
window.setWindowTitle('MyWindow')
window.show()
See also
The Qt documentation: https://doc.qt.io/qt-5
Writing a GUI plug-in called at Rumba start
Here is how to register a GUI plug-in. This plug-in will be run at Rumba start-up to customize the GUI.
import rumbapy
from rumbapy.WidgetPlugins import register_ui, UIPluginOptions
from PySide2 import QtWidgets, QtCore
class MyTools(QtCore.QObject):
def __init__(self, parent):
super(MyTools, self).__init__(parent)
main_window = rumbapy.widget("MainWindow")
# Add A new menu
my_menu = main_window.menubar.addMenu("&My Menu")
action = rumbapy.action.new(name="My Action", widget=main_window, trigger=doIt, icon="asset", shortcut=None)
# Add the action to the menu
my_menu.addAction(action)
def doIt(self):
main_window = rumbapy.widget("MainWindow")
QtWidgets.QMessageBox.information(main_window, 'Here', 'Congrats!')
register_ui(MyTools, "MyTools", UIPluginOptions(auto_create=True))
Put your code in a Python file in a plug-in directory.
See also
Set user plug-in directories with the RUMBA_USER_PLUGINS environment variable.
Set user resource directories with the RUMBA_USER_RESOURCES environment variable.