pyroom-team team mailing list archive
-
pyroom-team team
-
Mailing list archive
-
Message #00060
Patch to add "insert date time" command.
I've added the functionality to allow the user to insert the date at the
cursor, using CTRL+T it inserts it in a basic local format.
If you have any comments, code reviews etc please share.
If you wish to add it please do. I love your app and I plan on picking up
some of the bugs in the future, if you don't mind.
Thanks!!
Jason Stiebs
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: jason@lappy-20090914020204-md2lggc69ns8wsyi
# target_branch: http://bazaar.launchpad.net/%7Epyroom-\
# dev/pyroom/trunk/
# testament_sha1: 3a0665f73cf691dbb4cd425c42bed5ddf17d482f
# timestamp: 2009-09-13 21:07:44 -0500
# base_revision_id: florian-launchpad@xxxxxxxxxxxxxx-20090904081549-\
# 1268aqaxq4cwo28g
#
# Begin patch
=== modified file 'PyRoom/basic_edit.py'
--- PyRoom/basic_edit.py 2009-08-16 20:41:22 +0000
+++ PyRoom/basic_edit.py 2009-09-14 02:02:04 +0000
@@ -35,6 +35,7 @@
from preferences import Preferences
import autosave
from globals import state, config
+from datetime import datetime
FILE_UNNAMED = _('* Unnamed *')
@@ -51,7 +52,8 @@
_('Control-Y: Redo last typing'),
_('Control-Z: Undo last typing'),
_('Control-Page Up: Switch to previous buffer'),
-_('Control-Page Down: Switch to next buffer'), ])
+_('Control-Page Down: Switch to next buffer'),
+_('Control-T: Insert Date and Time')])
HELP = \
_("""PyRoom - distraction free writing
@@ -98,6 +100,7 @@
'w': edit_instance.close_dialog,
'y': edit_instance.redo,
'z': edit_instance.undo,
+ 't': edit_instance.insert_date,
}
ag = gtk.AccelGroup()
for key, value in keybindings.items():
@@ -592,8 +595,7 @@
errortext = _('Unable to save %(filename)s.') % {
'filename': buf.filename}
if errno == 13:
- errortext += _(' You do not have permission to write to \
-the file.')
+ errortext += _(' You do not have permission to write to the file.')
raise PyroomError(errortext)
except:
raise PyroomError(_('Unable to save %s\n') % buf.filename)
@@ -632,6 +634,11 @@
iter2.forward_word_end()
return count
+ def insert_date(self):
+ buf = self.buffers[self.current]
+ text = datetime.now().strftime("%c")
+ buf.insert_at_cursor(text)
+
def show_help(self):
""" Create a new buffer and inserts help """
buf = self.new_buffer()
@@ -766,3 +773,5 @@
"""cleanup before quitting"""
autosave.stop_autosave(self)
state['gui'].quit()
+
+
# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWdlowJcAAdlfgEQ0U+///340
TCq////wUARbrPPU63d2VwLxgSSE1TxNJ6RhqbU02ptInplP1TCZGEaHqbQQJSCJtMQk9PVHqaND
IyBoAAAGg0GgIkyntNUeiMmjIaAAyANA0AAxUyGp+qniJ6npGR6myjQGgGmQGgZABJImTSaYI1Np
TYENMSaGQaDIA00DgmZUtuseOfXMO3preAxQwtjXMtBGDKRojLKbAEj4sVkaidbNKoE0okwJ0tqw
jvxoJEe98iN8iCneHBJ2YHfTNjSOqFuZz179Z59viR4QPQb/NEBovfsWp2q4CCj1fFpGLzEjEdsd
+Srb1cuSZtD69rV3WcAocdTxGGi2Xqqx5YGx/8XvK/e2aJqOd97O6abZkMnMp+E5t4HC3HGaAlFb
yGQJaIOuP6DOIK241U1x7kQClhM212FqF42CcJzyDxcibqJhxN0vkpKcHCGFnHkYDjgW91QUqSZT
BR4Tt2IzpcuGox1Ql8eVJmJnDLw7PaZY5JhUCQxRy0lJmxwxITwWOAzl5YZmRfbeS61mIhmIGA1h
P2U9UXsrkYCFyxZOKktVL3iSeItFFhBiQHESEWJUMvJYVjiKOFk867SByQcVDisgPoJkmLQyiwIM
iCDJc1ApSiMhVsLRIsIK6V4PSMVLBqlWhpIqJSnekCJFpZSRJCoCgxltaXGBd8rpcihq7BZ7zEsa
QWFr1OWmMmIlIufx6N9kSlSkq1NMYwk0FnYZ2F2seOIr0tKU87Pys2Fly+RbmfFxFnPelECUnMyP
1viwKdHlwqDMVT2FiFA3SqkShAEjytM8AwLTCWmUWMNNVyEdETXC3PXfFLBTXZg0KE3Esvi6Fu+E
rV9t1Qpw4sA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