~ubuntu-branches/ubuntu/vivid/mago/vivid

« back to all changes in this revision

Viewing changes to mago/application/brasero.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2011-02-08 13:32:13 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110208133213-m1og7ey0m990chg6
Tags: 0.3+bzr20-0ubuntu1
* debian/rules:
  - updated to debhelper 7
  - use dh_python2 instead of python-central
* debian/pycompat:
  - removed, no longer needed
* debian/control:
  - dropped cdbs and python-central dependencies
* bzr snapshot of the current trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
PACKAGE = "mago"
2
 
 
3
 
#-*- coding:utf-8 -*-
4
 
"""
5
 
This is the "brasero" module.
6
 
 
7
 
This module provides a wrapper for LDTP to make writing Brasero tests easier.
8
 
"""
9
 
import ooldtp
10
 
import ldtp
11
 
import os
12
 
from .main import Application
13
 
from ..gconfwrapper import GConf
14
 
from ..cmd import globals
15
 
import time
16
 
import gettext
17
 
 
18
 
gettext.install (True)
19
 
gettext.bindtextdomain (PACKAGE, globals.LOCALE_SHARE)
20
 
gettext.textdomain (PACKAGE)
21
 
t = gettext.translation(PACKAGE, globals.LOCALE_SHARE, fallback = True)
22
 
_ = t.gettext
23
 
 
24
 
 
25
 
class Brasero(Application):
26
 
    """
27
 
    brasero manages the Brasero application.
28
 
    """
29
 
 
30
 
    LAUNCHER = 'brasero'
31
 
    LAUNCHER_ARGS = []
32
 
    WINDOW = 'frmBrasero*'
33
 
    
34
 
    DLG_SELECT_FILES = _('dlgSelectFiles')
35
 
    DLG_LOCATION_FOR = _('dlgLocationforImageFile')
36
 
    DLG_CREATINGIMAGE = _('dlgCreatingImage')
37
 
    BTN_0 = _('btn0')
38
 
    BTN_1 = _('btn1')
39
 
    BTN_2 = _('btn2')
40
 
    BTN_3 = _('btn3')
41
 
    BTN_4 = _('btn4')
42
 
    BTN_ADD = _('btnAdd')
43
 
    BTN_ADD1 = _('btnAdd1')
44
 
    BTN_ADD2 = _('btnAdd2')
45
 
    BTN_BURN = _('btnBurn*')
46
 
    BTN_CLOSE = _('btnClose')
47
 
    BTN_CREATEFOLDER = _('btnCreateFolder')
48
 
    BTN_CREATEIMAGE = _('btnCreateImage')
49
 
    BTN_DOWNPATH = _('btnDownPath')
50
 
    BTN_EMPTYPROJECT = _('btnEmptyProject')
51
 
    BTN_REMOVE = _('btnRemove')
52
 
    BTN_REMOVE1 = _('btnRemove1')
53
 
    BTN_REMOVE2 = _('btnRemove2')
54
 
    BTN_UPPATH = _('btnUpPath')
55
 
    BTN_ZOOMIN = _('btnZoomIn')
56
 
    BTN_ZOOMOUT = _('btnZoomOut')
57
 
    BTN_TYPE_A_FILENAME = _('btnTypeafilename')
58
 
    MNU_ABOUT = _('mnuAbout')
59
 
    MNU_ADDFILES = _('mnuAddFiles')
60
 
    MNU_ALLFILES = _('mnuAllfiles')
61
 
    MNU_AUDIOFILES = _('mnuAudiofiles')
62
 
    MNU_BLANK___ = _('mnuBlank...')
63
 
    MNU_BROWSETHEFILESYSTEM = _('mnuBrowsethefilesystem')
64
 
    MNU_BURNIMAGE___ = _('mnuBurnImage...')
65
 
    MNU_BURN___ = _('mnuBurn...')
66
 
    MNU_CHECKINTEGRITY___ = _('mnuCheckIntegrity...')
67
 
    MNU_CONTENTS = _('mnuContents')
68
 
    MNU_COPYDISC___ = _('mnuCopyDisc...')
69
 
    MNU_COVEREDITOR = _('mnuCoverEditor')
70
 
    MNU_DISPLAYPLAYLISTSANDTHEIRCONTENTS = _('mnuDisplayplaylistsandtheircontents')
71
 
    MNU_EJECT = _('mnuEject')
72
 
    MNU_EMPTY = _('mnuEmpty')
73
 
    MNU_EMPTY1 = _('mnuEmpty1')
74
 
    MNU_EMPTY2 = _('mnuEmpty2')
75
 
    MNU_EMPTY3 = _('mnuEmpty3')
76
 
    MNU_EMPTY4 = _('mnuEmpty4')
77
 
    MNU_EMPTY5 = _('mnuEmpty5')
78
 
    MNU_EMPTYPROJECT = _('mnuEmptyProject')
79
 
    MNU_GETHELPONLINE = _('mnuGetHelpOnline')
80
 
    MNU_IMAGEFILE = _('mnuImageFile')
81
 
    MNU_IMAGEFILES = _('mnuImagefiles')
82
 
    MNU_MOVIES = _('mnuMovies')
83
 
    MNU_NEWAUDIOPROJECT = _('mnuNewAudioProject')
84
 
    MNU_NEWDATAPROJECT = _('mnuNewDataProject')
85
 
    MNU_NEWVIDEOPROJECT = _('mnuNewVideoProject')
86
 
    MNU_NOITEMSFOUND = _('mnuNoitemsfound')
87
 
    MNU_OPEN___ = _('mnuOpen...')
88
 
    MNU_PLUGINS = _('mnuPlugins')
89
 
    MNU_QUIT = _('mnuQuit')
90
 
    MNU_REMOVEFILES = _('mnuRemoveFiles')
91
 
    MNU_REPORTAPROBLEM = _('mnuReportaProblem')
92
 
    MNU_SAVE = _('mnuSave')
93
 
    MNU_SAVEAS___ = _('mnuSaveAs...')
94
 
    MNU_TRANSLATETHISAPPLICATION = _('mnuTranslateThisApplication')
95
 
    TXT_0 = _('txt0')
96
 
    TXT_1 = _('txt1')
97
 
    TXT_LOCATION = _('txtLocation')
98
 
    TXT_NAME = _('txtName')
99
 
 
100
 
    def burn_path_to_iso(self, path_to_burn, iso_tmp_path):
101
 
        brasero = ooldtp.context(self.name)
102
 
 
103
 
        # Click on the new data project menu item
104
 
        brasero.getchild(self.MNU_NEWDATAPROJECT).selectmenuitem()
105
 
        ldtp.wait(2)
106
 
        # Click on the Add Files button
107
 
        brasero.getchild(self.BTN_ADD).click()
108
 
        ldtp.wait(2)
109
 
        #Select the files with the path previously assigned on the xml file. (data/)
110
 
        if (ldtp.guiexist(self.DLG_SELECT_FILES)):
111
 
           selectFiles = ooldtp.context(self.DLG_SELECT_FILES)
112
 
           if not (selectFiles.getchild(self.TXT_LOCATION)):
113
 
              ldtp.generatekeyevent('<ctrl>l')
114
 
           textLocation = selectFiles.getchild(self.TXT_LOCATION)
115
 
           textLocation.settextvalue(path_to_burn)
116
 
           ldtp.generatekeyevent('<return>')
117
 
        ldtp.wait(2)
118
 
        # Go back to Brasero window and click on Burn.
119
 
        ldtp.waittillguiexist(self.WINDOW)
120
 
        brasero.getchild(self.BTN_BURN).click()
121
 
        
122
 
        # wait for the dialog and enter the tmp path for the ISO previously assigned on the xml file.
123
 
        ldtp.waittillguiexist(self.DLG_LOCATION_FOR)
124
 
        
125
 
        if (ldtp.guiexist(self.DLG_LOCATION_FOR)):
126
 
            location = ooldtp.context(self.DLG_LOCATION_FOR)
127
 
            textISO = location.getchild(self.TXT_NAME)
128
 
            textISO.settextvalue(iso_tmp_path)
129
 
            if (location.getchild(self.BTN_CREATEIMAGE)):
130
 
                location.getchild(self.BTN_CREATEIMAGE).click()
131
 
            else:
132
 
                ldtp.generatekeyevent('<return>')
133
 
        else:
134
 
            ldtp.generatekeyevent('<return>')
135
 
        
136
 
        #Create the image and wait for the last dialog.
137
 
        ldtp.waittillguiexist(self.DLG_CREATINGIMAGE)
138
 
        creatingImage = ooldtp.context(self.DLG_CREATINGIMAGE)
139
 
        #Wait till the Close button is available, during the burn process only a Cancel button is shown to the user.
140
 
        ldtp.waittillguiexist(self.DLG_CREATINGIMAGE, self.BTN_CLOSE)
141
 
        creatingImage.getchild(self.BTN_CLOSE).click()
142
 
        ldtp.waittillguiexist(self.WINDOW)
143
 
        
144
 
    def __init__(self):
145
 
        Application.__init__(self)