Skip to content

Commit f6fd862

Browse files
committed
fixed profile saving issues
1 parent 9f30d3c commit f6fd862

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

openrgb/orgb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def save_profile(self, name: str, directory: str = ''):
316316
if directory == '':
317317
directory = environ['HOME'].rstrip("/") + "/.config/OpenRGB"
318318
with open(f'{directory.rstrip("/")}/{name}.orp', 'wb') as f:
319-
f.write(utils.Profile(self.devices).pack())
319+
f.write(utils.Profile([dev.data for dev in self.devices]).pack(0))
320320

321321
def update(self):
322322
'''

openrgb/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def pack(self, version: int) -> bytearray:
252252
self.color_mode
253253
)
254254
)
255-
data += pack_list(self.colors if self.colors is not None else [])
255+
data += pack_list(self.colors if self.colors is not None else [], version)
256256
data = struct.pack("I", len(data) + struct.calcsize("I")) + data
257257
return data
258258

@@ -373,7 +373,7 @@ def pack(self, version: int) -> bytearray:
373373
:returns: raw data ready to be sent or saved
374374
'''
375375
buff = (
376-
+ pack_string(self.description)
376+
pack_string(self.description)
377377
+ pack_string(self.version)
378378
+ pack_string(self.serial)
379379
+ pack_string(self.location)
@@ -493,11 +493,11 @@ class Profile:
493493
'''
494494
controllers: List[ControllerData]
495495

496-
def pack(self, version: int = 0) -> bytearray:
496+
def pack(self) -> bytearray:
497497
data = bytearray()
498498
data += struct.pack("16sI", b'OPENRGB_PROFILE\x00', 1)
499499
for dev in self.controllers:
500-
data += dev.data.pack(0)
500+
data += dev.pack(0)
501501
return data
502502

503503
@classmethod

0 commit comments

Comments
 (0)