Features/GTK3/Porting/Record: Difference between revisions
No edit summary |
No edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
'''Replace:''' | '''Replace:''' | ||
| Line 197: | Line 32: | ||
def load_colored_svg(filename, stroke, fill): | def load_colored_svg(filename, stroke, fill): | ||
path = os.path.join(constants.GFX_PATH, filename) | path = os.path.join(constants.GFX_PATH, filename) | ||
data = open(path, 'r').read() | data = open(path, 'r').read() | ||
| Line 224: | Line 60: | ||
return Rsvg.Handle.new_from_data(data.encode('utf-8')).get_pixbuf() | return Rsvg.Handle.new_from_data(data.encode('utf-8')).get_pixbuf() | ||
'''Not implement:''' | '''Not implement:''' | ||
| Line 230: | Line 65: | ||
super(Record, self).close() | super(Record, self).close() | ||
'''Due to:''' http://bugs.sugarlabs.org/ticket/4345 | '''Due to:''' [http://bugs.sugarlabs.org/ticket/4345] | ||
When an application fails and you want to close from the corresponding button occurs: | When an application fails and you want to close from the corresponding button occurs: | ||
Traceback (most recent call last): | Traceback (most recent call last): | ||
File "/usr/lib/python2.7/site-packages/sugar3/activity/activity.py", line 890, in _keep_failed_dialog_response_cb | File "/usr/lib/python2.7/site-packages/sugar3/activity/activity.py", line 890, in _keep_failed_dialog_response_cb | ||
| Line 287: | Line 123: | ||
ctx.fill() | ctx.fill() | ||
'''New Gst.TagList: | |||
Replace:''' | |||
taglist = self._get_tags(constants.TYPE_AUDIO) | taglist = self._get_tags(constants.TYPE_AUDIO) | ||
| Line 331: | Line 166: | ||
def _get_tags(self, type): | def _get_tags(self, type): | ||
tl = gst.TagList() | tl = gst.TagList() | ||
tl[gst.TAG_ARTIST] = self.model.get_nickname() | tl[gst.TAG_ARTIST] = self.model.get_nickname() | ||
tl[gst.TAG_COMMENT] = "olpc" | tl[gst.TAG_COMMENT] = "olpc" | ||
tl[gst.TAG_ALBUM] = "olpc" | |||
tl[gst.TAG_ALBUM] = "olpc" | |||
tl[gst.TAG_DATE] = utils.getDateString(int(time.time())) | tl[gst.TAG_DATE] = utils.getDateString(int(time.time())) | ||
stringType = constants.MEDIA_INFO[type]['istr'] | stringType = constants.MEDIA_INFO[type]['istr'] | ||
tl[gst.TAG_TITLE] = _('%(type)s by %(name)s') % {'type': stringType, | tl[gst.TAG_TITLE] = _('%(type)s by %(name)s') % {'type': stringType, | ||
'name': self.model.get_nickname()} | 'name': self.model.get_nickname()} | ||
| Line 360: | Line 193: | ||
Gst.TAG_COMMENT, | Gst.TAG_COMMENT, | ||
"olpc") | "olpc") | ||
taglist.add_value( | taglist.add_value( | ||
| Line 374: | Line 204: | ||
utils.getDateString(int(time.time()))) | utils.getDateString(int(time.time()))) | ||
stringType = constants.MEDIA_INFO[type]['istr | stringType = constants.MEDIA_INFO[type]['istr'] | ||
taglist.add_value( | taglist.add_value( | ||
| Line 383: | Line 213: | ||
return taglist | return taglist | ||
GObject.get_data() and set_data() are deprecated. Use normal Python attributes instead | |||
button.set_data('handler-ids', (clicked_handler, remove_handler, clipboard_handler)) | |||
'''No joint implementation:''' | |||
self.connect('size_allocate', self._size_allocate_cb) | |||
def _size_allocate_cb(self, widget, requisition): | |||
. . . | |||
and | |||
def do_size_allocate(self, allocation): | |||
. . . | |||
'''Replace:''' | |||
taglist.add_value( | |||
Gst.TagMergeMode.REPLACE, | |||
Gst.TAG_DATE, | |||
utils.getDateString(int(time.time()))) | |||
def getDateString( when ): | |||
return strftime( "%c", time.localtime(when) ) | |||
'''By:''' | |||
datetime = GLib.DateTime.new_now_local() | |||
date = GLib.Date() | |||
date.set_day(datetime.get_day_of_month()) | |||
date.set_month(datetime.get_month()) | |||
date.set_year(datetime.get_year()) | |||
taglist.add_value( | |||
Gst.TagMergeMode.REPLACE, | |||
Gst.TAG_DATE, | |||
date) | |||