Skip to content

Commit

Permalink
Merge pull request OpenShot#2425 from ferdnyc/qt-color-picker
Browse files Browse the repository at this point in the history
Color picker: Never use native dialog
  • Loading branch information
DylanC authored Dec 13, 2018
2 parents 2a6ec68 + ee3eab7 commit 7a15ffc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/windows/views/blender_listview.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ def dropdown_index_changed(self, widget, param, index):
log.info('New value of param: %s' % value)

def color_button_clicked(self, widget, param, index):
# Get translation object
_ = get_app()._tr

# Show color dialog
log.info('Animation param being changed: %s' % param["name"])
color_value = self.params[param["name"]]
Expand All @@ -227,7 +230,8 @@ def color_button_clicked(self, widget, param, index):
if len(color_value) == 3:
#currentColor = QColor(color_value[0], color_value[1], color_value[2])
currentColor.setRgbF(color_value[0], color_value[1], color_value[2])
newColor = QColorDialog.getColor(currentColor)
newColor = QColorDialog.getColor(currentColor, self, _("Select a Color"),
QColorDialog.DontUseNativeDialog)
if newColor.isValid():
widget.setStyleSheet("background-color: {}".format(newColor.name()))
self.params[param["name"]] = [newColor.redF(), newColor.greenF(), newColor.blueF()]
Expand Down
9 changes: 7 additions & 2 deletions src/windows/views/properties_tableview.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ def mouseReleaseEvent(self, event):

def doubleClickedCB(self, model_index):
"""Double click handler for the property table"""

# Get translation object
_ = get_app()._tr

# Get data model and selection
model = self.clip_properties_model.model

Expand All @@ -291,7 +295,8 @@ def doubleClickedCB(self, model_index):

# Show color dialog
currentColor = QColor(red, green, blue)
newColor = QColorDialog.getColor(currentColor)
newColor = QColorDialog.getColor(currentColor, self, _("Select a Color"),
QColorDialog.DontUseNativeDialog)

# Set the new color keyframe
self.clip_properties_model.color_update(self.selected_item, newColor)
Expand Down Expand Up @@ -737,4 +742,4 @@ def __init__(self, *args):
self.setLayout(hbox)

# Connect signals
get_app().window.propertyTableView.loadProperties.connect(self.select_item)
get_app().window.propertyTableView.loadProperties.connect(self.select_item)

0 comments on commit 7a15ffc

Please sign in to comment.