[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 07:52:04 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                        |  
------------------------------------------+---------------------------------
Changes (by jzGreen):

  * keywords:  sugar-love => sugar-love, r?


Comment:

 |TestCase|
 Press Alt-1 to take a screenshot within an activity.
 Ensure the title of the newly created journal-entry matches the activity
 name.

 |TestCase|
 Press Alt-1 at the other zoom levels, mesh, group, and home.
 Ensure the title matches the zoom level.

 Boundry cases, untested but handled in code.
 |TestCase|  Press Alt-1 in an activity with no (None) title.
 |TestCase|  Press Alt-1 with no active activity.

 PATCH:

 {{{
 diff --git a/extensions/globalkey/screenshot.py
 b/extensions/globalkey/screenshot.py
 index b7538ef..4adacda 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 ' + 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:4>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list