[Bugs] #650 UNSP: Screenshots to use name of current activity as part of its default title

SugarLabs Bugs bugtracker-noreply at sugarlabs.org
Tue May 26 11:42:00 EDT 2009


#650: Screenshots to use name of current activity as part of its default title
------------------------------------------+---------------------------------
    Reporter:  garycmartin                |          Owner:  jzGreen    
        Type:  enhancement                |         Status:  accepted   
    Priority:  Unspecified by Maintainer  |      Milestone:  0.86       
   Component:  sugar                      |        Version:  0.84.x     
    Severity:  Minor                      |     Resolution:             
    Keywords:  sugar-love, r?             |   Distribution:  Unspecified
Status_field:  New                        |  
------------------------------------------+---------------------------------

Comment(by jzGreen):

 {{{
 diff --git a/extensions/globalkey/screenshot.py
 b/extensions/globalkey/screenshot.py
 index b7538ef..ddc3e0b 100644
 --- a/extensions/globalkey/screenshot.py
 +++ b/extensions/globalkey/screenshot.py
 @@ -23,9 +23,11 @@ from gettext import gettext as _
  import gtk
  import gconf
  import dbus
 +import logging

  from sugar.datastore import datastore
  from sugar.graphics import style
 +from jarabe.model import shell

  BOUND_KEYS = ['<alt>1', 'Print']

 @@ -48,7 +50,28 @@ def handle_key_press(key):

      jobject = datastore.create()
      try:
 -        jobject.metadata['title'] = _('Screenshot')
 +        title = _('Screenshot')
 +        try:
 +            shell_model = shell.get_model()
 +            zoom_level = shell_model.zoom_level
 +            activity = shell_model.get_active_activity()
 +            cases={
 +                shell_model.ZOOM_MESH: lambda : 'Mesh',
 +                shell_model.ZOOM_GROUP: lambda : 'Group',
 +                shell_model.ZOOM_HOME: lambda : 'Home',
 +                shell_model.ZOOM_ACTIVITY: lambda : activity.get_title()
 +            }
 +            if zoom_level in cases.keys():
 +                title = cases[zoom_level]()
 +                if title == None:
 +                    title = 'Activity'
 +                title = _('Screenshot of %s' % title)
 +            else:
 +                raise TitleError
 +        except:
 +            logging.debug('Screenshot: using default title')
 +            pass
 +        jobject.metadata['title'] = title
          jobject.metadata['keep'] = '0'
          jobject.metadata['buddies'] = ''
          jobject.metadata['preview'] = _get_preview_data(screenshot)
 }}}

-- 
Ticket URL: <http://dev.sugarlabs.org/ticket/650#comment:5>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list