Skip to content

Commit

Permalink
Cleanup remove dead code and small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
facelessuser committed Jun 30, 2023
1 parent 976219e commit 95129ca
Showing 1 changed file with 1 addition and 51 deletions.
52 changes: 1 addition & 51 deletions rummage/lib/gui/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def replace(m, fmt_repl=format_replace):
if m.group(2):
# Unicode (wide and narrow) and bytes
value = int(m.group(2)[2:], 16)
elif m.group(3):
else:
# Octal
value = int(m.group(3)[1:], 8)

Expand All @@ -142,53 +142,3 @@ def to_ustr(obj):
return str(obj, 'utf-8')
else:
return str(obj)


def to_bgr(color):
"""
Convert to `colRGB`.
This is a `wxPython` type which is basically `BGR`. We don't want to work with
`BGR`, so being able to simply convert `RGB` is preferable.
"""

return ((color & 0xFF0000) >> 16) | (color & 0xFF00) | ((color & 0xFF) << 16)


def to_rgb(color):
"""
Convert from `colRGB`.
`colRGB` is a `wxPython` type which is basically `BGR`. We don't want to work with
`BGR`, so being able to simply convert `RGB` is preferable.
The algorithm is actually the same swapping in either direction, but having a clear name
makes it obvious what is wanted.
"""

return to_bgr(color)


def to_abgr(color):
"""
Convert to `colRGB`.
This is a `wxPython` type which is basically `BGR`. We don't want to work with
`BGR`, so being able to simply convert `RGB` is preferable.
"""

return ((color & 0xFF000000) >> 24) | ((color & 0xFF0000) >> 8) | ((color & 0xFF00) >> 8) | ((color & 0xFF) << 24)


def to_rgba(color):
"""
Convert from `colRGB`.
`colRGB` is a `wxPython` type which is basically `BGR`. We don't want to work with
`BGR`, so being able to simply convert `RGB` is preferable.
The algorithm is actually the same swapping in either direction, but having a clear name
makes it obvious what is wanted.
"""

return to_abgr()

0 comments on commit 95129ca

Please sign in to comment.