Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added hacky drop-down with "replace all instances" on color rows #285

Merged
merged 18 commits into from
Feb 27, 2020
Merged

Added hacky drop-down with "replace all instances" on color rows #285

merged 18 commits into from
Feb 27, 2020

Conversation

AKAStacks
Copy link
Contributor

I probably need help on this; but I really want to be able to change all matching colors in the ColorsList globally somehow. With this pull, you can functionally right click on a colorbutton and all rows with matching colors will also be changed to the selected color.

It's a small modification, but it's definitely not done the correct way. Please point me in the correct direction.

Modified colors_list.OomoxColorButton:

  • changed init so that on_click is linked to "button_pressed_event" event vs. "clicked" signal to allow to detect left(1) vs right(3) click
  • implemented get_listbox_parent to reference button's parent ListBox object
  • changed colors_list.OomoxColorButton.on_click to use the above to iterate through sibling listboxrows and modify those that match the original value
  • had to modify colors_list.ColorListBoxRow.set_value func, adding a kword arg so that it would stay connected to update the preview the way I wanted

@AKAStacks AKAStacks requested a review from actionless February 23, 2020 04:04
Copy link
Member

@actionless actionless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of implicit right-click action it should be a linked dropdown button with menu, with at the moment only one menu item "Replace all occurrences", so users could know what there is an extra action attached to color button

that would also help to avoid most of the modifications

@actionless
Copy link
Member

also, dropdown anyway will be needed for #112 and few other planned features

@AKAStacks
Copy link
Contributor Author

Thank you for the feedback--I'll work on this tomorrow. :)

@actionless
Copy link
Member

i was speaking about linked dropdown button, not right-click menu
2020-02-25--1582594814_152x56_scrot

@AKAStacks
Copy link
Contributor Author

AKAStacks commented Feb 25, 2020

I do not see this in my environment; the color_entry boxes are essentially simple text boxes. In fact, in my environment the octothorp isn't even present in the value, for example https://imgur.com/X3HvXML.png.

I'll look more into this tomorrow, and how it might be implemented on a Gtk.Entry object or however it will need to work.

@actionless
Copy link
Member

actionless commented Feb 25, 2020

it's currently a linked group of text entry and color button

to the same linked group should be added a third item, a dropdown button with menu

ignore the octothorp, that's not related to the point, that's not a screenshot from oomox, but a demonstration of how linked entry with dropdown button look like

@AKAStacks
Copy link
Contributor Author

AKAStacks commented Feb 26, 2020

I apologize: I'm not a programmer by trade, and this is my first "contribution." I didn't grok/understand your ("linked" (style)) terminology until I searched a bit. I feel I have accomplished what you've requested, except "avoiding most of the modifications" a la your first review.

self.color_entry.get_style_context().add_class(Gtk.STYLE_CLASS_MONOSPACE)
linked_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
Gtk.StyleContext.add_class(
linked_box.get_style_context(), "linked"
)
linked_box.add(self.color_entry)
linked_box.add(self.menu_button)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please swap places of menu_button and color_button (so the dropdown will be rightmost)


def replace_all_instances(self, _menu_item): # pylint:disable=unused-argument

_menu_item = self._menu_item # noqa: F841
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's bad you ignored the warning -- it seems it should be:

self._menu_item = _menu_item

@actionless
Copy link
Member

by "avoiding most of the modifications" i meant exactly the state of your PR as it is now :)
without extra hacks for handling right click


def replace_all_instances(self, _menu_item): # pylint:disable=unused-argument

_menu_item = self._menu_item # noqa: F841
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

however it doesn't seems you need this line at all, as _menu_item is not used next in the code

@AKAStacks
Copy link
Contributor Author

Thank you for your (extra) help. Let me know if you want any other modifications. I love this piece of software. 👍

@AKAStacks AKAStacks changed the title Added hacky right-click-on-color-button global color replace Added hacky drop-down with "replace all instances" on color rows Feb 27, 2020
@actionless
Copy link
Member

thanks for your dedication on polishing the pull request!

@actionless actionless merged commit e32af40 into themix-project:master Feb 27, 2020
@AKAStacks AKAStacks deleted the global-color-replace branch February 29, 2020 07:04
@AKAStacks
Copy link
Contributor Author

It bothers me that this fails the Travis "build;" I would like to assist with some other functionalities. I think, at this point, that makes you a Senior Software Engineer.

@actionless
Copy link
Member

actionless commented Feb 29, 2020 via email

@actionless
Copy link
Member

green again :)
f7745f5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants