Skip to content

Commit c879397

Browse files
committed
Added documentation for using profiles
1 parent 1679fcd commit c879397

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

docs/pages/advanced.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,29 @@ you try to call :any:`OpenRGBClient.connect()` or try to initialize an
112112
the client loses connection to the SDK server after the initial connection, then
113113
trying to interact with the SDK server will cause an :any:`OpenRGBDisconnected`
114114
error.
115+
116+
Offline Profile Editing
117+
-----------------------
118+
119+
Binary OpenRGB profiles, with the '.orp' suffix, can be loaded directly into
120+
OpenRGB-Python as a :any:`Profile` object if you want to inspect or edit an
121+
existing profile.
122+
123+
.. note::
124+
125+
This doesn't require a connection the OpenRGB SDK server
126+
127+
.. code-block:: python
128+
129+
from openrgb.utils import Profile
130+
131+
# Loading a Profile object
132+
with open('/path/to/profile.orp', rb) as f:
133+
my_profile = Profile.unpack(f)
134+
135+
# Modifying the profile
136+
my_profile.controllers[0].colors[0] = RGBColor(255, 0, 0)
137+
138+
# Saving a profile
139+
with open('/path/to/new_profile.orp', 'wb') as f:
140+
f.write(my_profile.pack())

docs/pages/usage.rst

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ few more options.
2121
This will connect to an OpenRGB SDK server at :code:`192.168.1.111:8000` with
2222
the name :code:`My client!`.
2323

24-
Getting Devices
25-
---------------
24+
Selecting Devices
25+
-----------------
2626
On initialization, the :any:`OpenRGBClient` will create :any:`Device` objects
2727
for all of your OpenRGB Devices. You can list these out by :code:`print`-ing
2828
:code:`cli.devices`. Devices can be accessed through their index in this list,
@@ -120,3 +120,35 @@ resize it at some point.
120120
.. code-block:: python
121121
122122
mobo.zones[0].resize(35)
123+
124+
Using Profiles
125+
--------------
126+
Once you have set your RGB exactly how you like it, you probably want to save
127+
the state into a profile. With OpenRGB-Python, this is pretty simple. This
128+
function will save the current state of you lights to a profile.
129+
130+
.. code-block:: python
131+
132+
cli.save_profile('perfection')
133+
134+
This will save a profile called perfection.orp in OpenRGB's config directory by
135+
default, so you can load the profile directly from OpenRGB's profile list.
136+
137+
Loading profiles in OpenRGB-Python is equally as simple as saving them. This
138+
function will set your lights to the same as they were when they were saved.
139+
It can load profiles saved from OpenRGB itself, or OpenRGB-Python.
140+
141+
.. code-block:: python
142+
143+
cli.load_profile('perfection')
144+
145+
.. warning::
146+
147+
I only know where OpenRGB's config directory is on linux and I haven't
148+
tested saving profiles on windows. The default directory that
149+
OpenRGB-Python saves profiles is :code:`~/.config/OpenRGB`. If you know
150+
where OpenRGB's config directory is on windows and how to reliably find it
151+
from python, please submit a pr or come talk to me on OpenRGB's discord
152+
server. In the mean time, you will probably have to manually specify the
153+
directory where you want to save or load a profile from using the
154+
:code:`directory` argument.

0 commit comments

Comments
 (0)