~ubuntu-branches/ubuntu/utopic/dogtail/utopic

« back to all changes in this revision

Viewing changes to dogtail/apps/wrappers/gnomepanel.py

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2006-12-21 13:33:47 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20061221133347-xo9jg11afp5plcka
Tags: upstream-0.6.1
ImportĀ upstreamĀ versionĀ 0.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""Wrapper code to help when scripting gnome-panel
2
 
 
3
 
Author: David Malcolm <dmalcolm@redhat.com>"""
4
 
 
5
 
__author__ = 'David Malcolm <dmalcolm@redhat.com>'
6
 
 
7
 
from dogtail.tree import *
8
 
from dogtail.distro import packageDb
9
 
from dogtail.apps.categories import *
10
 
from dogtail.version import Version
11
 
 
12
 
class GnomePanel(Application, DesktopPanel):
13
 
        """Useful test hooks for GNOME panel testcases"""
14
 
        def __init__(self):
15
 
                Application.__init__(self, root.application("gnome-panel"))
16
 
 
17
 
                self.version = packageDb.getVersion("gnome-panel")
18
 
                
19
 
                print "gnome-panel version %s"%self.version
20
 
 
21
 
        def getApplicationsMenu(self):
22
 
                if self.version>=Version([2,10.0]):
23
 
                        # this works on FC5:
24
 
                        return self.child(name = 'Applications', roleName = 'menu', recursive=True, debugName="Applications menu")
25
 
                else:
26
 
                        # this makes it work on FC3:
27
 
                        # assume that the first menu we find is the main menu:
28
 
                        return self.findChild(predicate.GenericPredicate(roleName="menu"), recursive=True, debugName="Applications menu")
29
 
 
30
 
        def applications(self):
31
 
                """Generator of MenuItem for all menuitems representing applications under the Applications menu."""
32
 
                appMenu = self.getApplicationsMenu()
33
 
 
34
 
                return appMenu.findChildren(predicate.GenericPredicate(roleName="menu item"), recursive=True)
35