Skip to content

Commit

Permalink
Fixed Classic color picker bug and default color issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nimaid committed Nov 29, 2019
1 parent 8d581d4 commit 7413819
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.7
0.1.8
12 changes: 8 additions & 4 deletions window.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
STAT_INACTIVE_COLOR = "#444"
SELECT_COLOR = "#f00"
DEFAULT_COLOR = [0, 0, 255]
MK1_DEFAULT_COLOR = [0, 255, 0]
INDICATOR_BPM = 480
BUTTON_FONT = ("helvetica", 11, "bold")

Expand Down Expand Up @@ -424,7 +425,10 @@ def validate_func():
colors_to_set[x][y] = lp_colors.code_to_RGB(colors_to_set[x][y])

if all(c < 4 for c in colors_to_set[x][y]):
colors_to_set[x][y] = DEFAULT_COLOR
if lp_mode == "Mk1":
colors_to_set[x][y] = MK1_DEFAULT_COLOR
else:
colors_to_set[x][y] = DEFAULT_COLOR

ask_color_func = lambda: self.ask_color(w, color_button, x, y, colors_to_set[x][y])
color_button = tk.Button(w, text="Select Color", command=ask_color_func)
Expand Down Expand Up @@ -490,10 +494,10 @@ def make_color_button(button_color, column, row, size=100):
for c in range(4):
for r in range(4):
if not (c == 0 and r == 3):
red = max(0, (c * 64) - 1)
green = max(0, ((3 - r) * 64) - 1)
red = (c * 64)
green = ((3 - r) * 64)

make_color_button((red, green, 0), c, r)
make_color_button((red, green, 0), c, r, size=75)

w.wait_visibility()
w.grab_set()
Expand Down

0 comments on commit 7413819

Please sign in to comment.