49
49
_('Control-W: Close buffer and exit if it was the last buffer'),
50
50
_('Control-Y: Redo last typing'),
51
51
_('Control-Z: Undo last typing'),
52
_('Control-1: Partial word count.'),
53
52
_('Control-Page Up: Switch to previous buffer'),
54
_('Control-Page Down: Switch to next buffer'), ])
53
_('Control-Page Down: Switch to next buffer'),
54
_('Control-1 through Control-5: Partial word counts.'), ])
57
57
_("""PyRoom - distraction free writing
450
456
status = _(' (modified)')
453
self.status.set_text(_('Buffer %(buffer_id)d: %(buffer_name)s\
461
self.status.set_text(_('%(buffer_id)s%(buffer_name)s%(status)s%(char_count)s%(word_count)s%(partial_one)s%(partial_two)s%(partial_three)s%(partial_four)s%(partial_five)s%(lines)s') % {
462
'buffer_id': 'Buffer: ' + str(self.current + 1) + ' ',
463
'buffer_name': buf.filename if int(config.get('visual', 'showpath')) else os.path.split(buf.filename)[1],
464
'status': status + ' ',
465
'char_count': 'Characters: ' + str(buf.get_char_count()) + ' ',
466
'word_count': 'Words: ' + str(self.word_count(buf)) + ' ',
467
'partial_one': 'Partial 1: ' + str(self.get_partial(buf, 0)) + ' ' if self.buffers[self.current].partials[0] > 0 else "",
468
'partial_two': 'Partial 2: ' + str(self.get_partial(buf, 1)) + ' ' if self.buffers[self.current].partials[1] > 0 else "",
469
'partial_three': 'Partial 3: ' + str(self.get_partial(buf, 2)) + ' ' if self.buffers[self.current].partials[2] > 0 else "",
470
'partial_four': 'Partial 4: ' + str(self.get_partial(buf, 3)) + ' ' if self.buffers[self.current].partials[3] > 0 else "",
471
'partial_five': 'Partial 5: ' + str(self.get_partial(buf, 4)) + ' ' if self.buffers[self.current].partials[4] > 0 else "",
472
'lines': 'Lines: ' + str(buf.get_line_count()),
475
self.status.set_text(_('Buffer %(buffer_id)d: %(buffer_name)s\
454
476
%(status)s, %(char_count)d character(s), %(word_count)d word(s)\
455
, %(partial_words)s %(lines)d line(s)') % {
456
'buffer_id': self.current + 1,
457
'buffer_name': buf.filename if int(config.get('visual', 'showpath')) else os.path.split(buf.filename)[1],
459
'char_count': buf.get_char_count(),
460
'word_count': self.word_count(buf),
461
'partial_words': str(self.get_partial(buf)) + " partial, " if state['partial_wordcount'] > 0 else "",
462
'lines': buf.get_line_count(),
477
, %(partial_one)s%(partial_two)s%(partial_three)s%(partial_four)s\
478
%(partial_five)s %(lines)d line(s)') % {
479
'buffer_id': self.current + 1,
480
'buffer_name': buf.filename if int(config.get('visual', 'showpath')) else os.path.split(buf.filename)[1],
482
'char_count': buf.get_char_count(),
483
'word_count': self.word_count(buf),
484
'partial_one': str(self.get_partial(buf, 0)) + " partial 1, " if self.buffers[self.current].partials[0] > 0 else "",
485
'partial_two': str(self.get_partial(buf, 1)) + " partial 2, " if self.buffers[self.current].partials[1] > 0 else "",
486
'partial_three': str(self.get_partial(buf, 2)) + " partial 3, " if self.buffers[self.current].partials[2] > 0 else "",
487
'partial_four': str(self.get_partial(buf, 3)) + " partial 4, " if self.buffers[self.current].partials[3] > 0 else "",
488
'partial_five': str(self.get_partial(buf, 4)) + " partial 5, " if self.buffers[self.current].partials[4] > 0 else "",
489
'lines': buf.get_line_count(),
481
508
self.status.set_text(_('Nothing more to redo!'))
525
def partial(self, count):
484
526
"""set or unset partial wordcount"""
485
if state['partial_wordcount'] == 0:
486
state['partial_wordcount'] = self.word_count(self.buffers[self.current])
527
if self.buffers[self.current].partials[count] == 0:
528
self.buffers[self.current].partials[count] = self.word_count(self.buffers[self.current])
488
state['partial_wordcount'] = 0
530
self.buffers[self.current].partials[count] = 0
490
def get_partial(self, buf):
491
return self.word_count(buf) - state['partial_wordcount']
532
def get_partial(self, buf, count):
533
return self.word_count(self.buffers[self.current]) - self.buffers[self.current].partials[count]
493
535
def ask_restore(self):
494
536
"""ask if backups should be restored