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

Add TRANSMIGRATED_BOX to where it's missing from #1473

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions data/menubar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<menuitem action='toggle_checkbox'/>
<menuitem action='xtoggle_checkbox'/>
<menuitem action='migrate_checkbox'/>
<menuitem action='transmigrate_checkbox'/>
</menu>
<menuitem action='edit_object'/>
<menuitem action='remove_link'/>
Expand Down
3 changes: 3 additions & 0 deletions data/style.conf
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,7 @@ foreground=#4e9a06
[Tag migrated-checkbox]
#foreground = grey

[Tag transmigrated-checkbox]
#foreground = grey

# vim: syntax=desktop
1 change: 1 addition & 0 deletions tests/data/formats/export.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ <h4>head 4</h4>
<p>
<ul>
<li class="migrated-box">Migrated checkbox</li>
<li class="transmigrated-box">Transmigrated checkbox</li>
</ul>
</p>

Expand Down
1 change: 1 addition & 0 deletions tests/data/formats/export.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ TODO list:


* ▷ Migrated checkbox
* ◁ Transmigrated checkbox


A numbered list:
Expand Down
1 change: 1 addition & 0 deletions tests/data/formats/export.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ TODO list:
- ☒ baz

- ▷ Migrated checkbox
- ◁ Transmigrated checkbox

A numbered list:
1. foo
Expand Down
1 change: 1 addition & 0 deletions tests/data/formats/export.tex
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ \subsubsection{head 4}

\begin{itemize}
\item[\RIGHTarrow] Migrated checkbox
\item[\LEFTarrow] Transmigrated checkbox
\end{itemize}


Expand Down
2 changes: 1 addition & 1 deletion tests/data/formats/parsetree.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ and also <strike>strike through</strike>

<p>TODO list:
<ul><li bullet="unchecked-box">foo</li><li bullet="checked-box">bar</li><ul><li bullet="checked-box">sub item 1</li><ul><li bullet="*">Some normal bullet</li></ul><li bullet="checked-box">sub item 2</li></ul><li bullet="xchecked-box">baz</li></ul></p>
<p><ul><li bullet="migrated-box">Migrated checkbox</li></ul></p>
<p><ul><li bullet="migrated-box">Migrated checkbox</li><li bullet="transmigrated-box">Transmigrated checkbox</li></ul></p>
<p>A numbered list:
<ol start="1"><li>foo</li><li>bar</li><ol start="a"><li>sub list</li><li>here</li></ol><li>hmmm</li></ol></p>

Expand Down
1 change: 1 addition & 0 deletions tests/data/formats/plain.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ TODO list:
[x] baz

[>] Migrated checkbox
[<] Transmigrated checkbox

A numbered list:
1. foo
Expand Down
1 change: 1 addition & 0 deletions tests/data/formats/wiki.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ TODO list:
[x] baz

[>] Migrated checkbox
[<] Transmigrated checkbox

A numbered list:
1. foo
Expand Down
5 changes: 5 additions & 0 deletions tests/pageview.py
Original file line number Diff line number Diff line change
Expand Up @@ -2930,6 +2930,11 @@ def testMigrateCheckBox(self):
pageview.migrate_checkbox()
self.assertEqual(pageview.page.dump('wiki'), ['[>] my task\n'])

def testTransmigrateCheckBox(self):
pageview = setUpPageView(self.setUpNotebook(), '[*] my task\n')
pageview.transmigrate_checkbox()
self.assertEqual(pageview.page.dump('wiki'), ['[<] my task\n'])

def testEditObjectForLink(self):
pageview = setUpPageView(self.setUpNotebook(), '[[link]]\n')

Expand Down
1 change: 1 addition & 0 deletions zim/formats/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Dumper(TextDumper):
XCHECKED_BOX: '* \u2612',
CHECKED_BOX: '* \u2611',
MIGRATED_BOX: '* \u25B7',
TRANSMIGRATED_BOX: '* \u25C1',
BULLET: '*',
}

Expand Down
1 change: 1 addition & 0 deletions zim/formats/rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Dumper(TextDumper):
XCHECKED_BOX: '- \u2612',
CHECKED_BOX: '- \u2611',
MIGRATED_BOX: '- \u25B7',
TRANSMIGRATED_BOX: '- \u25C1',
BULLET: '-',
}

Expand Down
11 changes: 8 additions & 3 deletions zim/gui/pageview/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2411,6 +2411,7 @@ def get_bullet(self, line):
CHECKED_BOX
XCHECKED_BOX
MIGRATED_BOX
TRANSMIGRATED_BOX
or a numbered list bullet (test with L{is_numbered_bullet_re})
'''
iter = self.get_iter_at_line(line)
Expand Down Expand Up @@ -2926,7 +2927,8 @@ def toggle_checkbox(self, line, checkbox_type=None, recursive=False):

@param line: the line number
@param checkbox_type: the checkbox type that we want to toggle:
one of C{CHECKED_BOX}, C{XCHECKED_BOX}, C{MIGRATED_BOX}.
one of C{CHECKED_BOX}, C{XCHECKED_BOX}, C{MIGRATED_BOX},
C{TRANSMIGRATED_BOX}.
If C{checkbox_type} is given, it toggles between this type and
unchecked. Otherwise it rotates through unchecked, checked
and xchecked.
Expand Down Expand Up @@ -3400,6 +3402,7 @@ def set_bullet(self, row, bullet):
UNCHECKED_BOX
XCHECKED_BOX
MIGRATED_BOX
TRANSMIGRATED_BOX
'''
assert bullet in BULLETS
with self.buffer.user_action:
Expand All @@ -3408,7 +3411,7 @@ def set_bullet(self, row, bullet):
pass
elif bullet == UNCHECKED_BOX:
self._checkbox_unchecked(row)
else: # CHECKED_BOX, XCHECKED_BOX, MIGRATED_BOX
else: # CHECKED_BOX, XCHECKED_BOX, MIGRATED_BOX, TRANSMIGRATED_BOX
self._checkbox_checked(row, bullet)

def _checkbox_unchecked(self, row):
Expand Down Expand Up @@ -6162,11 +6165,13 @@ def do_mark_set(self, buffer, iter, mark):
self.actiongroup.get_action('toggle_checkbox').set_sensitive(True)
self.actiongroup.get_action('xtoggle_checkbox').set_sensitive(True)
self.actiongroup.get_action('migrate_checkbox').set_sensitive(True)
self.actiongroup.get_action('transmigrate_checkbox').set_sensitive(True)
else:
self.actiongroup.get_action('uncheck_checkbox').set_sensitive(False)
self.actiongroup.get_action('toggle_checkbox').set_sensitive(False)
self.actiongroup.get_action('xtoggle_checkbox').set_sensitive(False)
self.actiongroup.get_action('migrate_checkbox').set_sensitive(False)
self.actiongroup.get_action('transmigrate_checkbox').set_sensitive(False)

if buffer.get_link_tag(iter):
self.actiongroup.get_action('remove_link').set_sensitive(True)
Expand Down Expand Up @@ -6476,8 +6481,8 @@ def _checkbox_do_populate_popup(self, menu, buffer, iter):
menu.prepend(Gtk.SeparatorMenuItem())

for bullet, label in (
introt marked this conversation as resolved.
Show resolved Hide resolved
(MIGRATED_BOX, _('Check Checkbox \'>\'')), # T: popup menu menuitem
(TRANSMIGRATED_BOX, _('Check Checkbox \'<\'')), # T: popup menu menuitem
(MIGRATED_BOX, _('Check Checkbox \'>\'')), # T: popup menu menuitem
(XCHECKED_BOX, _('Check Checkbox \'X\'')), # T: popup menu menuitem
(CHECKED_BOX, _('Check Checkbox \'V\'')), # T: popup menu menuitem
(UNCHECKED_BOX, _('Un-check Checkbox')), # T: popup menu menuitem
Expand Down