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

command chaining functionality in config #89

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

harindu95
Copy link

I wanted to make windows borderless when I tile them. Now you can do command chaining with ','

KP_2 = borderless,bottom
KP_5 = WithBorder,center

yay!

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 33.307% when pulling c1aeaaf on harindu95:master into dac1e1a on ssokolow:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 33.36% when pulling f4064c3 on harindu95:master into dac1e1a on ssokolow:master.

@ssokolow
Copy link
Owner

Sorry for taking so long to reply. The last few days have been busy.

I'll try to find time to review this within the next couple of days.

Copy link
Owner

@ssokolow ssokolow left a comment

Choose a reason for hiding this comment

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

The main problem I see with these changes is that they are inconsistent with the existing naming conventions within QuickTile.

I've attached instructions to the specific problem sites for how to fix the problem.

@@ -341,12 +355,17 @@ def move_to_position(winman, # type: WindowManager
winman.reposition(win, result, use_rect, gravity=gravity,
geometry_mask=gravity_mask)

@commands.add('WithBorder', True)
@commands.add('borderless', False)
Copy link
Owner

Choose a reason for hiding this comment

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

The use of capitals rather than dashes to indicate word boundaries in WithBorder is inconsistent with the naming convention for the rest of the commands.

Also, using borderless implies that bordered isn't a toggle.

Please change these to bordered-set and bordered-unset so there's no ambiguity and their naming is consistent if I decide to generalize the naming pattern to all of the toggles. (eg. maximize-set and maximize-unset)

Copy link
Author

Choose a reason for hiding this comment

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

Yeah. I wasn't sure about how to name it considering some options were capitalized while some were not.

Copy link
Owner

Choose a reason for hiding this comment

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

There shouldn't be any. I certainly don't see any capitals in the output of quicktile --show-actions on my end.

Copy link
Author

Choose a reason for hiding this comment

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

mmm not the actions. But some of the [general ] config are capitalized while some are not. Since I was considering adding "boderless" as a general state, I guess it kind of bled through on my end.

@@ -167,9 +167,9 @@ def decorate(func):
return func
return decorate

def call(self, command, winman, *args, **kwargs):
def check_command(self, command, winman, *args, **kwargs):
""" check if the command is valid and execute it"""
Copy link
Owner

Choose a reason for hiding this comment

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

The name check_command implies that it won't execute the command if it does exist. (A view supported by the docstring saying "check ... and execute it".)

Please either leave this as call or rename it to try_call.

@@ -183,6 +183,20 @@ def call(self, command, winman, *args, **kwargs):
logging.error("Unrecognized command: %s", command)
return False

def call(self, command, winman, *args, **kwargs):
# type: (str, WindowManager, *Any, **Any) -> bool
"""Resolve a textual positioning command and execute it."""
Copy link
Owner

Choose a reason for hiding this comment

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

Please update this docstring to make it clear that the method accepts a comma-separated list of commands.

@@ -183,6 +183,20 @@ def call(self, command, winman, *args, **kwargs):
logging.error("Unrecognized command: %s", command)
return False

def call(self, command, winman, *args, **kwargs):
Copy link
Owner

Choose a reason for hiding this comment

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

There's no expectation that a completely unadorned name like call on a command registry should support a list of calls.

Please rename this to something like call_multiple. The places you'll need to adjust to support the new name are:

  • At the end of main in __main__.py, where command-line input is handled
  • At the end of doCommand in dbus_api.py
  • In the call closure at the end of keybinder.py

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 33.36% when pulling 8d0d0e9 on harindu95:master into dac1e1a on ssokolow:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 33.36% when pulling 76e97dc on harindu95:master into dac1e1a on ssokolow:master.

Copy link
Owner

@ssokolow ssokolow left a comment

Choose a reason for hiding this comment

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

Just one last thing to correct and then I can merge it.

# type: (str, WindowManager, *Any, **Any) -> bool
"""Resolve a textual positioning command and execute it."""
Copy link
Owner

Choose a reason for hiding this comment

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

ssokolow@monolith quicktile [master] % ./run_tests.sh 
[...]
quicktile/commands.py:172: error: misplaced type annotation

Copy link
Author

Choose a reason for hiding this comment

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

Great! That's done.

@ssokolow
Copy link
Owner

That said, next time I revise the docs, I'll probably also want to add a note that space-separated command-chaining on the command-line is deprecated and may be removed some day in the distant future.

@ssokolow
Copy link
Owner

Sorry for remaining silent after your changes.

It's been a very messy week. I'll try to do a final check and then get this merged within the next few days.

"""Resolve a textual positioning command and execute it.
Accepts a comma seperated list as the command."""
# type: (str, WindowManager, *Any, **Any) -> bool
Copy link
Owner

Choose a reason for hiding this comment

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

I'll probably need another day or two.

If I'm seeing List[str] turn into str in type signatures without any explanation (whether it's a correction or a mistake), it suggests that, as a responsible project maintainer, I need to do a full audit before merging to make sure I wouldn't be letting in any new bugs.

@ssokolow
Copy link
Owner

ssokolow commented Nov 1, 2017

Travis-CI is dying with the current version of your pull request with IndentationError: unexpected unindent. That's a flat-out parser error. (ie. It indicates that you didn't even try to run the code you submitted.)

Given how long this has already taken, if I can find the time within the next week, I'll just clean it up myself.

@ssokolow
Copy link
Owner

Sorry for the lack of progress. I haven't forgotten about you. I just have some deadlines looming on other projects.

This reverts commit f4892f262eb984cad9add54602c4f3c71c0dbc82.
This reverts commit cdf6ea0ac272443e53ed8e23c48039459e14f755.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 33.36% when pulling 418185a on harindu95:master into dac1e1a on ssokolow:master.

@harindu95
Copy link
Author

Sorry for being so clumsy. I am still a newbie so forgive me :) . I think I cleaned up the code and the type annotations and it totally works on my machine at least.

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.

None yet

3 participants