summaryrefslogtreecommitdiff
path: root/plugins/reorder.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2018-08-15 13:13:17 +0200
committermathieui <mathieui@mathieui.net>2018-08-15 13:13:17 +0200
commit6e13b8b73572f9c0ac9b5c683b98a475afbeab38 (patch)
tree7dae86588339a8cf144b2d98c9280f28646341a9 /plugins/reorder.py
parentd1b624753bb5371cf287cc9d86bb685593a99315 (diff)
downloadpoezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.gz
poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.bz2
poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.xz
poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.zip
yapf -rip on plugins
Diffstat (limited to 'plugins/reorder.py')
-rw-r--r--plugins/reorder.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/plugins/reorder.py b/plugins/reorder.py
index 5ba23c59..7308196d 100644
--- a/plugins/reorder.py
+++ b/plugins/reorder.py
@@ -80,6 +80,7 @@ TAB_TO_TEXT = {
tabs.GapTab: 'empty'
}
+
def parse_config(tab_config):
result = {}
for option in tab_config.options('reorder'):
@@ -96,12 +97,14 @@ def parse_config(tab_config):
return result
+
def check_tab(tab):
for cls, rep in TAB_TO_TEXT.items():
if isinstance(tab, cls):
return rep
return ''
+
def parse_runtime_tablist(tablist):
props = []
i = 0
@@ -112,13 +115,18 @@ def parse_runtime_tablist(tablist):
props.append((i, '%s:%s' % (result, tab.name)))
return props
+
class Plugin(BasePlugin):
def init(self):
- self.api.add_command('reorder', self.command_reorder,
- help='Reorder all tabs using the pre-defined'
- ' layout from the configuration file.')
- self.api.add_command('save_order', self.command_save_order,
- help='Save the current tab layout')
+ self.api.add_command(
+ 'reorder',
+ self.command_reorder,
+ help='Reorder all tabs using the pre-defined'
+ ' layout from the configuration file.')
+ self.api.add_command(
+ 'save_order',
+ self.command_save_order,
+ help='Save the current tab layout')
@command_args_parser.ignored
def command_save_order(self):
@@ -145,7 +153,9 @@ class Plugin(BasePlugin):
last = 0
for pos in sorted(tabs_spec):
if create_gaps and pos > last + 1:
- new_tabs += [tabs.GapTab(self.core) for i in range(pos - last - 1)]
+ new_tabs += [
+ tabs.GapTab(self.core) for i in range(pos - last - 1)
+ ]
cls, name = tabs_spec[pos]
tab = self.core.tabs.by_name_and_class(name, cls=cls)
if tab and tab in old_tabs: