本文整理汇总了Python中sugar3.datastore.datastore.create函数的典型用法代码示例。如果您正苦于以下问题:Python create函数的具体用法?Python create怎么用?Python create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __export_pdf_cb
def __export_pdf_cb(self, event):
maxx, maxy = self._main_area.get_max_area()
true_width = int(maxx)
true_height = int(maxy)
# Create the new journal entry
fileObject = datastore.create()
act_meta = self.metadata
fileObject.metadata['title'] = act_meta['title'] + ' (PDF)'
fileObject.metadata['title_set_by_user'] = \
act_meta['title_set_by_user']
fileObject.metadata['mime_type'] = 'application/pdf'
# TODO: add text thoughts into fulltext metadata
# fileObject.metadata['fulltext'] = ...
fileObject.metadata['icon-color'] = act_meta['icon-color']
fileObject.file_path = os.path.join(self.get_activity_root(),
'instance', '%i' % time.time())
filename = fileObject.file_path
surface = cairo.PDFSurface(filename, true_width, true_height)
cairo_context = cairo.Context(surface)
context = Pango.create_context(cairo_context)
self._main_area.export(context, true_width, true_height, False)
surface.finish()
datastore.write(fileObject, transfer_ownership=True)
fileObject.destroy()
del fileObject
开发者ID:sugarlabs,项目名称:laybrinth-activity,代码行数:28,代码来源:labyrinthactivity.py
示例2: create_journal_entry
def create_journal_entry(self, tempfile):
journal_entry = datastore.create()
journal_title = self.selected_title
if self.selected_volume != '':
journal_title += ' ' + _('Volume') + ' ' + self.selected_volume
if self.selected_author != '':
journal_title = journal_title + ', by ' + self.selected_author
journal_entry.metadata['title'] = journal_title
journal_entry.metadata['title_set_by_user'] = '1'
journal_entry.metadata['keep'] = '0'
if _NEW_TOOLBAR_SUPPORT:
format = self.format_combo.props.value
else:
format = self._books_toolbar.format_combo.props.value
if format == '.epub':
journal_entry.metadata['mime_type'] = 'application/epub+zip'
if format == '.djvu':
journal_entry.metadata['mime_type'] = 'image/vnd.djvu'
if format == '.pdf' or format == '_bw.pdf':
journal_entry.metadata['mime_type'] = 'application/pdf'
journal_entry.metadata['buddies'] = ''
journal_entry.metadata['preview'] = ''
journal_entry.metadata['icon-color'] = profile.get_color().to_string()
textbuffer = self.textview.get_buffer()
journal_entry.metadata['description'] = textbuffer.get_text(textbuffer.get_start_iter(), textbuffer.get_end_iter(), True)
journal_entry.file_path = tempfile
datastore.write(journal_entry)
os.remove(tempfile)
self.progressbar.hide()
self._alert(_('Success'), self.selected_title + _(' added to Journal.'))
开发者ID:leonardcj,项目名称:getiabooks,代码行数:30,代码来源:GetIABooksActivity.py
示例3: __export_png_cb
def __export_png_cb(self, event):
x, y, w, h, bitdepth = self._main_area.window.get_geometry()
cmap = self._main_area.window.get_colormap()
maxx, maxy = self._main_area.get_max_area()
true_width = int(maxx)
true_height = int(maxy)
# Create the new journal entry
fileObject = datastore.create()
act_meta = self.metadata
fileObject.metadata['title'] = act_meta['title'] + ' (PNG)'
fileObject.metadata['title_set_by_user'] = \
act_meta['title_set_by_user']
fileObject.metadata['mime_type'] = 'image/png'
fileObject.metadata['icon-color'] = act_meta['icon-color']
fileObject.file_path = os.path.join(self.get_activity_root(),
'instance', '%i' % time.time())
filename = fileObject.file_path
#pixmap = gtk.gdk.Pixmap(None, true_width, true_height, bitdepth)
#pixmap.set_colormap(cmap)
#self._main_area.export(pixmap.cairo_create(), true_width, true_height,
# False)
#pb = gtk.gdk.Pixbuf.get_from_drawable(
# gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, true_width,
# true_height),
# pixmap, gtk.gdk.colormap_get_system(), 0, 0, 0, 0, true_width,
# true_height)
pb.save(filename, 'png')
datastore.write(fileObject, transfer_ownership=True)
fileObject.destroy()
del fileObject
开发者ID:sugarlabs,项目名称:laybrinth-activity,代码行数:34,代码来源:labyrinthactivity.py
示例4: save
def save(self):
"""
Save the current font loaded in globals.FONT as a .ufo.zip file.
The file will be saved in the activity data folder
"""
ufo_path = self._create_font_instance()
title = self.get_title()
zip_path =\
os.path.join(self.get_activity_root(),
'data', '%s_ufo.zip' % (title))
if globals.FONT.save_zip(ufo_path, zip_path) is True:
# create a journal entry
jobject = datastore.create()
# FIXME: This method of setting the metadata is not working
# set the title to the output of self.get_title()
jobject.metadata['icon-color'] = profile.get_color().to_string()
jobject.metadata['mime_type'] = 'application/zip'
jobject.metadata['title'] = title
jobject.file_path = zip_path
datastore.write(jobject, transfer_ownership=True)
self._object_id = jobject.object_id
# create an alert
success_title = 'Success'
success_msg = 'A UFO Font zip file was created in the Journal'
self._show_journal_alert(_(success_title), _(success_msg))
else:
# create an alert
failure_title = 'Error'
failure_msg = 'Could not create the Zip file'
self._show_journal_alert(_(failure_title), _(failure_msg))
开发者ID:sugarlabs,项目名称:edit-fonts-activity,代码行数:34,代码来源:EditFonts.py
示例5: __export_as_html_cb
def __export_as_html_cb(self, button):
jobject = datastore.create()
jobject.metadata['title'] = \
_('{} as HTML').format(self.metadata['title'])
jobject.metadata['mime_type'] = 'text/html'
preview = self.get_preview()
if preview is not None:
jobject.metadata['preview'] = dbus.ByteArray(preview)
# write out the document contents in the requested format
path = os.path.join(self.get_activity_root(),
'instance', str(time.time()))
with open(path, 'w') as f:
f.write('''<html>
<head>
<title>{title}</title>
</head>
<body>
<h1>{title}</h1>
'''.format(title=jobject.metadata['title']))
for item in self._main_list.all():
f.write('<p>{}</p>'.format(
item[self._main_list.COLUMN_TEXT]))
f.write('''
</body>
</html>
''')
jobject.file_path = path
datastore.write(jobject, transfer_ownership=True)
self._journal_alert(jobject.object_id, _('Success'), _('Your'
' Bibliography was saved to the journal as HTML'))
jobject.destroy()
del jobject
开发者ID:AbrahmAB,项目名称:bibliography-activity,代码行数:35,代码来源:activity.py
示例6: export_font
def export_font(self):
"""
Export the current font loaded in globals.FONT as a .otf file.
The file will be saved in the activity data folder
"""
# create the file path
file_path =\
os.path.join(self.get_activity_root(),
'data', '%s.otf' % self.get_title)
# save the otf
globals.FONT.export_binary(file_path)
# create a journal entry
jobject = datastore.create()
jobject.metadata['icon-color'] = profile.get_color().to_string()
jobject.metadata['mime_type'] = 'application/x-font-opentype'
jobject.metadata['title'] = '%s.otf' % self.get_title
jobject.file_path = file_path
datastore.write(jobject, transfer_ownership=True)
self._object_id = jobject.object_id
success_title = 'Success'
success_msg = 'A OTF Font file was created in the Journal'
self._show_journal_alert(_(success_title), _(success_msg))
开发者ID:sugarlabs,项目名称:edit-fonts-activity,代码行数:26,代码来源:EditFonts.py
示例7: _install_update
def _install_update(self, bundle_update, local_file_path):
total = self._total_bundles_to_update
current = total - len(self._bundles_to_update) - 0.5
self.emit('progress', UpdateModel.ACTION_UPDATING,
bundle_update.bundle.get_name(),
current, total)
# TODO: Should we first expand the zip async so we can provide progress
# and only then copy to the journal?
jobject = datastore.create()
try:
title = '%s-%s' % (bundle_update.bundle.get_name(),
bundle_update.version)
jobject.metadata['title'] = title
jobject.metadata['mime_type'] = ActivityBundle.MIME_TYPE
jobject.file_path = local_file_path
datastore.write(jobject, transfer_ownership=True)
finally:
jobject.destroy()
self.emit('progress', UpdateModel.ACTION_UPDATING,
bundle_update.bundle.get_name(),
current + 0.5, total)
if self._bundles_to_update:
# do it in idle so the UI has a chance to refresh
GLib.idle_add(self._download_next_update)
开发者ID:axitkhurana,项目名称:sugar,代码行数:29,代码来源:model.py
示例8: generate_bundle
def generate_bundle(nick, new_basename):
"""Generate a new .xo bundle for the activity and copy it into the
Journal.
"""
new_activity_name = _customize_activity_info(
nick, new_basename)
user_activities_path = get_user_activities_path()
if os.path.exists(os.path.join(user_activities_path, new_basename,
'dist')):
for path in glob.glob(os.path.join(user_activities_path, new_basename,
'dist', '*')):
os.remove(path)
config = bundlebuilder.Config(source_dir=os.path.join(
user_activities_path, new_basename),
dist_name='%s-1.xo' % (new_activity_name))
bundlebuilder.cmd_dist_xo(config, None)
dsobject = datastore.create()
dsobject.metadata['title'] = '%s-1.xo' % (new_activity_name)
dsobject.metadata['mime_type'] = 'application/vnd.olpc-sugar'
dsobject.set_file_path(os.path.join(
user_activities_path, new_basename, 'dist',
'%s-1.xo' % (new_activity_name)))
datastore.write(dsobject)
dsobject.destroy()
开发者ID:ChristoferR,项目名称:sugar,代码行数:28,代码来源:customizebundle.py
示例9: do_drag_data_get
def do_drag_data_get(self, path, selection):
data = self.get_iter(path)
mime_type = self.get_value(data, 13)
fileid = self.get_value(data, 14)
title = self.get_value(data, 15)
data = self._account.download_file(fileid, self._display_alert)
fd, file_path = tempfile.mkstemp(dir="/tmp/")
os.close(fd)
if data[0]:
f = open(file_path, 'w')
f.write(data[0])
f.close()
jobject = datastore.create()
jobject.metadata['title'] = title
jobject.metadata['icon-color'] = profile.get_color().to_string()
jobject.metadata['mime_type'] = mime_type
if data[1]:
jobject.metadata['activity'] = data[1]
if data[0]:
jobject.file_path = file_path
datastore.write(jobject)
self._load_files()
self._journal_button.set_active(True)
self._listview.refresh()
开发者ID:i5o,项目名称:sugar-gdrive,代码行数:28,代码来源:account.py
示例10: __init__
def __init__(self, file_transfer):
BaseTransferButton.__init__(self, file_transfer)
self._ds_object = datastore.create()
file_transfer.connect('notify::state', self.__notify_state_cb)
file_transfer.connect('notify::transferred-bytes',
self.__notify_transferred_bytes_cb)
icons = Gio.content_type_get_icon(file_transfer.mime_type).props.names
icons.append('application-octet-stream')
for icon_name in icons:
icon_name = 'transfer-from-%s' % icon_name
file_name = get_icon_file_name(icon_name)
if file_name is not None:
self.props.icon_widget.props.icon_name = icon_name
self.notif_icon.props.icon_name = icon_name
break
icon_color = file_transfer.buddy.props.color
self.props.icon_widget.props.xo_color = icon_color
self.notif_icon.props.xo_color = icon_color
frame = jarabe.frame.get_view()
frame.add_notification(self.notif_icon,
Gtk.CornerType.TOP_LEFT)
开发者ID:AxEofBone7,项目名称:sugar,代码行数:26,代码来源:activitiestray.py
示例11: initialize_journal_object
def initialize_journal_object(title=None, bundle_id=None,
activity_id=None, project_metadata=None,
icon_color=None, invited=False):
if not icon_color:
settings = Gio.Settings('org.sugarlabs.user')
icon_color = settings.get_string('color')
if not activity_id:
activity_id = activityfactory.create_activity_id()
jobject = datastore.create()
jobject.metadata['title'] = title
jobject.metadata['title_set_by_user'] = '0'
jobject.metadata['activity_id'] = activity_id
jobject.metadata['keep'] = '0'
jobject.metadata['preview'] = ''
jobject.metadata['icon-color'] = icon_color
jobject.file_path = ''
if bundle_id == PROJECT_BUNDLE_ID:
jobject.metadata['activity'] = PROJECT_BUNDLE_ID
elif project_metadata is not None:
jobject.metadata['mountpoints'] = ['/']
jobject.metadata['activity'] = bundle_id
jobject.metadata['share-scope'] = SCOPE_PRIVATE
jobject.metadata['launch-times'] = str(int(time.time()))
jobject.metadata['spent-times'] = '0'
jobject.metadata['project_id'] = project_metadata['uid']
# FIXME: We should be able to get an ID synchronously from the DS,
# then call async the actual create.
# http://bugs.sugarlabs.org/ticket/2169
datastore.write(jobject)
return jobject
开发者ID:AbrahmAB,项目名称:sugar,代码行数:35,代码来源:journalactivity.py
示例12: create_journal_entry
def create_journal_entry(self, widget, data=None):
filename = self._filechooser.get_filename()
journal_entry = datastore.create()
journal_entry.metadata['title'] = self.make_new_filename(filename)
journal_entry.metadata['title_set_by_user'] = '1'
journal_entry.metadata['keep'] = '0'
file_mimetype = mime.get_for_file(filename)
if not file_mimetype is None:
journal_entry.metadata['mime_type'] = file_mimetype
journal_entry.metadata['buddies'] = ''
if file_mimetype.startswith('image/') and file_mimetype != 'image/vnd.djvu':
preview = self.create_preview_metadata(filename)
elif file_mimetype == 'application/x-cbz':
fname = self.extract_image(filename)
preview = self.create_preview_metadata(fname)
os.remove(fname)
else:
preview = ''
if not preview == '':
journal_entry.metadata['preview'] = dbus.ByteArray(preview)
else:
journal_entry.metadata['preview'] = ''
journal_entry.file_path = filename
datastore.write(journal_entry)
self.update_log_entries += '\n' + _('File %s copied to the Journal.') % filename
self.alert(_('Success'), _('%s added to Journal.')
% self.make_new_filename(filename))
开发者ID:leonardcj,项目名称:sugar-commander,代码行数:28,代码来源:sugarcommander.py
示例13: _file_part_receiver
def _file_part_receiver(self, target, filename, part, numparts,
bytes, title=None, color=None, sender=None):
# ignore my own signal
if sender == self._tube.get_unique_name():
return
if target != self._tube.get_unique_name() and target != 'all':
return
# first chunk
if part == 1:
tmp_root = join(environ['SUGAR_ACTIVITY_ROOT'], 'instance')
temp_dir = tempfile.mkdtemp(dir=tmp_root)
chmod(temp_dir, 0777)
self.temp_file = join(temp_dir, 'game.zip')
self.files[filename] = self.temp_file
self.f = open(self.temp_file, 'a+b')
self.f.write(bytes)
percentage = int(float(part) / float(numparts) * 100.0)
self.game.set_load_mode(_('Receiving game') + ': '
+ str(percentage) + '% ' + _('done') + '.')
# last chunk
if part == numparts:
self.f.close()
# file = self.files[filename]
# Saves the zip in datastore
gameObject = datastore.create()
gameObject.metadata['title'] = title
gameObject.metadata['mime_type'] = 'application/x-memorize-project'
gameObject.metadata['icon-color'] = color
gameObject.file_path = self.temp_file
datastore.write(gameObject)
开发者ID:leonardcj,项目名称:memorize-activity,代码行数:35,代码来源:messenger.py
示例14: take_screenshot
def take_screenshot(self, capture_count=1):
''' Take a screenshot and save to the Journal '''
tmp_file_path = os.path.join(
os.environ['SUGAR_ACTIVITY_ROOT'], 'instance',
'screen_capture_' + str(capture_count) + '.png')
window = self.activity.wave.get_window()
width, height = window.get_width(), window.get_height()
surface = Gdk.Window.create_similar_surface(window,
cairo.CONTENT_COLOR,
width, height)
cr = cairo.Context(surface)
Gdk.cairo_set_source_window(cr, window, 0, 0)
cr.paint()
surface.write_to_png(tmp_file_path)
if os.path.exists(tmp_file_path):
dsobject = datastore.create()
try:
dsobject.metadata['title'] = '%s %d' % (_('Waveform'),
capture_count)
dsobject.metadata['keep'] = '0'
dsobject.metadata['buddies'] = ''
dsobject.metadata['preview'] = self._get_preview_data(surface)
dsobject.metadata['icon-color'] = self.activity.icon_colors
dsobject.metadata['mime_type'] = 'image/png'
dsobject.set_file_path(tmp_file_path)
datastore.write(dsobject)
finally:
dsobject.destroy()
del dsobject
os.remove(tmp_file_path)
return True
return False
开发者ID:sugarlabs,项目名称:Measure,代码行数:34,代码来源:journal.py
示例15: __export_as_abiword_cb
def __export_as_abiword_cb(self, button):
jobject = datastore.create()
jobject.metadata['title'] = \
_('{} as Write document').format(self.metadata['title'])
jobject.metadata['mime_type'] = 'application/x-abiword'
preview = self.get_preview()
if preview is not None:
jobject.metadata['preview'] = dbus.ByteArray(preview)
path = os.path.join(self.get_activity_root(),
'instance', str(time.time()))
with open(path, 'w') as f:
f.write('<?xml version="1.0" encoding="UTF-8"?>\n<abiword>\n'
'<section>')
entries = []
for item in self._main_list.all():
markup = item[self._main_list.COLUMN_TEXT]
abiword = '<p><c>{}</c></p>'.format(markup) \
.replace('<b>', '<c props="font-weight:bold">') \
.replace('<i>', '<c props="font-style:italic;'
' font-weight:normal">') \
.replace('</b>', '</c>').replace('</i>', '</c>')
entries.append(abiword)
f.write('\n<p><c></c></p>\n'.join(entries))
f.write('</section>\n</abiword>')
jobject.file_path = path
datastore.write(jobject, transfer_ownership=True)
self._journal_alert(jobject.object_id, _('Success'), _('Your'
' Bibliography was saved to the journal as a Write'
' document'))
jobject.destroy()
del jobject
开发者ID:AbrahmAB,项目名称:bibliography-activity,代码行数:33,代码来源:activity.py
示例16: save_bundle
def save_bundle(self, btn):
# create bundle
builder = XOPackager(Builder(Config(self.activity_dir, '/tmp')))
builder.package()
logging.error('Packaging %s', builder.package_path)
jobject = datastore.create()
icon_color = profile.get_color().to_string()
metadata = {
'title': '%s-%s.xo' % (builder.config.bundle_name,
builder.config.version),
'title_set_by_user': '1',
'suggested_filename': '%s-%s.xo' % (builder.config.bundle_name,
builder.config.version),
'icon-color': icon_color,
'mime_type': 'application/vnd.olpc-sugar',
'activity': '',
'activity_id': '',
'share-scope': activity.SCOPE_PRIVATE,
'preview': '',
'source': self.activity_dir, }
for k, v in metadata.items():
jobject.metadata[k] = v
jobject.file_path = builder.package_path
datastore.write(jobject)
jobject.destroy()
self._show_alert(_('The bundle has been saved in the journal.'),
_('Success'))
开发者ID:svineet,项目名称:develop-activity,代码行数:29,代码来源:develop_app.py
示例17: save_as_pdf
def save_as_pdf(self, widget):
tmp_dir = os.path.join(self._activity.get_activity_root(), "tmp")
fd, file_path = tempfile.mkstemp(dir=tmp_dir)
os.close(fd)
page = self._canvas.get_current_page()
webview = self._canvas.get_children()[page].get_children()[0]
operation = Gtk.PrintOperation.new()
operation.set_export_filename(file_path)
webview.get_main_frame().print_full(operation, Gtk.PrintOperationAction.EXPORT)
client = GConf.Client.get_default()
jobject = datastore.create()
color = client.get_string("/desktop/sugar/user/color")
try:
jobject.metadata["title"] = _("Browse activity as PDF")
jobject.metadata["icon-color"] = color
jobject.metadata["mime_type"] = "application/pdf"
jobject.file_path = file_path
datastore.write(jobject)
finally:
self.__pdf_alert(jobject.object_id)
jobject.destroy()
del jobject
开发者ID:richaseh,项目名称:browse,代码行数:26,代码来源:webtoolbar.py
示例18: publish
def publish(activity, force=False):
if not [i for i in book.custom.index if i['ready']]:
alert = NotifyAlert(5)
alert.props.title = _('Nothing to publish')
alert.props.msg = _('Mark arcticles from "Custom" '
'panel and try again.')
alert.connect('response', __alert_notify_response_cb, activity)
activity.add_alert(alert)
alert.show()
return
title = activity.metadata['title']
jobject = datastore.find({
'activity_id': activity.get_id(),
'activity' : book.custom.uid})[0] or None
logger.debug('publish: title=%s jobject=%s force=%s' \
% (title, jobject and jobject[0].metadata['activity'], force))
if jobject:
if force:
jobject = jobject[0]
else:
alert = ConfirmationAlert()
alert.props.title = _('Overwrite existed bundle?')
alert.props.msg = _('A bundle for current object was already created. '
'Click "OK" to overwrite it.')
alert.connect('response', __alert_response_cb, activity, True)
activity.add_alert(alert)
alert.show()
jobject[0].destroy()
return
else:
jobject = datastore.create()
jobject.metadata['activity_id'] = activity.get_id()
jobject.metadata['activity'] = book.custom.uid
jobject.metadata['mime_type'] = 'application/vnd.olpc-content'
jobject.metadata['description'] = \
'This is a bundle containing articles on %s.\n' \
'To view these articles, open the \'Browse\' Activity.\n' \
'Go to \'Books\', and select \'%s\'.' % (title, title)
book.custom.sync_article()
book.custom.revision += 1
jobject.metadata['title'] = title
_publish(title, jobject)
jobject.destroy()
book.custom.sync_index()
alert = NotifyAlert()
alert.props.title = _('Book published to your Journal')
alert.props.msg = _('You can read the book in Browse or '
'access the .xol file from your Journal')
alert.connect('response', __alert_notify_response_cb, activity)
activity.add_alert(alert)
alert.show()
开发者ID:iamutkarshtiwari,项目名称:infoslicer,代码行数:58,代码来源:xol.py
示例19: take_screenshot
def take_screenshot():
tmp_dir = os.path.join(env.get_profile_path(), 'data')
fd, file_path = tempfile.mkstemp(dir=tmp_dir)
os.close(fd)
window = Gdk.get_default_root_window()
width, height = window.get_width(), window.get_height()
screenshot_surface = Gdk.Window.create_similar_surface(
window, cairo.CONTENT_COLOR, width, height)
cr = cairo.Context(screenshot_surface)
Gdk.cairo_set_source_window(cr, window, 0, 0)
cr.paint()
screenshot_surface.write_to_png(file_path)
settings = Gio.Settings('org.sugarlabs.user')
color = settings.get_string('color')
content_title = None
shell_model = shell.get_model()
zoom_level = shell_model.zoom_level
# TRANS: Nouns of what a screenshot contains
if zoom_level == shell_model.ZOOM_MESH:
content_title = _('Mesh')
elif zoom_level == shell_model.ZOOM_GROUP:
content_title = _('Group')
elif zoom_level == shell_model.ZOOM_HOME:
content_title = _('Home')
elif zoom_level == shell_model.ZOOM_ACTIVITY:
activity = shell_model.get_active_activity()
if activity is not None:
content_title = activity.get_title()
if content_title is None:
content_title = _('Activity')
if content_title is None:
title = _('Screenshot')
else:
title = _('Screenshot of \"%s\"') % content_title
jobject = datastore.create()
try:
jobject.metadata['title'] = title
jobject.metadata['keep'] = '0'
jobject.metadata['buddies'] = ''
jobject.metadata['preview'] = _get_preview_data(screenshot_surface)
jobject.metadata['icon-color'] = color
jobject.metadata['mime_type'] = 'image/png'
jobject.file_path = file_path
datastore.write(jobject, transfer_ownership=True)
finally:
jobject.destroy()
del jobject
return title
开发者ID:AbrahmAB,项目名称:sugar,代码行数:57,代码来源:screenshot.py
示例20: _add_to_journal
def _add_to_journal(self, title, file_path):
jobject = datastore.create()
jobject.metadata['title'] = title
jobject.metadata['description'] = "Saved from web console"
jobject.metadata['mime_type'] = "application/zip"
jobject.file_path = file_path
datastore.write(jobject)
# Cleans the instance directory after every save
self.__clean_fiddler_dir()
开发者ID:iamutkarshtiwari,项目名称:Browse-fiddleFeature,代码行数:10,代码来源:webconsole.py
注:本文中的sugar3.datastore.datastore.create函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论