diff --git a/AUTHORS b/AUTHORS index acdd64a..9105bc7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,6 +6,7 @@ Prashanth Mohan K.Harishankaran Venkateswaran S S.Theyagarajan +Shreyank Gupta Contributors - Active Patrick Gu diff --git a/python/ChangeLog b/python/ChangeLog index e8ee511..e68e847 100644 --- a/python/ChangeLog +++ b/python/ChangeLog @@ -1,3 +1,17 @@ +2008-07-11 Shreyank Gupta + + * ldtpeditor.glade: Added dialogs necessary to implement user + defined window support. + + * ldtpeditor: Added modules and Classes to implement dialogs for + user defined window support. + + * appdata: new file that keeps track of the window names supported + by the application. + + * Makefile.am: change to copy 'appdata' file to its specified + directory + 2008-06-27 Nagappan A * ldtpeditor: Removed copy / paste clip board code, which is by diff --git a/python/Makefile.am b/python/Makefile.am index 1ec535c..d9e3d7d 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -6,6 +6,7 @@ python_DATA = \ pyc_DATA = $(python_DATA:.py=.pyc) pycdir = $(pythondir) gladedir=$(datadir)/ldtp/glade +appdir = $(datadir)/ldtp %.pyc: %.py $(PYTHON_CMD) -c "import py_compile; py_compile.compile ('$<', '$@')" @@ -15,6 +16,8 @@ bin_SCRIPTS = \ ldtpeditor \ ldtprunner +app_DATA = appdata + glade_DATA = ldtpeditor.glade SUBDIRS = ldtplib diff --git a/python/ldtpeditor b/python/ldtpeditor index b5164d6..af5e63a 100755 --- a/python/ldtpeditor +++ b/python/ldtpeditor @@ -97,18 +97,19 @@ class LdtpEditorGui (gnome.Program): gnome.Program.__init__ (self) ldtpEditorApp = gnome.program_init ('LDTP Editor', '1.0.0') gladeFileName = "ldtpeditor.glade" - gladeFilePath = './' + gladeFileName + self.gladeFilePath = './' + gladeFileName if os.path.exists (gladeFileName): - gladeFilePath = sys.path [0] + '/' + gladeFileName + self.gladeFilePath = sys.path [0] + '/' + gladeFileName else: - gladeFilePath = '/usr/share/ldtp/glade/' + gladeFileName - if os.path.exists (gladeFilePath) is False: - gladeFilePath = '/usr/share/local/ldtp/glade/' + gladeFileName - self.wTree = gtk.glade.XML (gladeFilePath) + self.gladeFilePath = '/usr/share/ldtp/glade/' + gladeFileName + if os.path.exists (self.gladeFilePath) is False: + self.gladeFilePath = '/usr/share/local/ldtp/glade/' + gladeFileName + self.wTree = gtk.glade.XML (self.gladeFilePath) dic = { "on_quit_activate" : self.quittingApplication, "on_ldtpeditor_destroy_event" : self.quittingApplication, "on_preference_clicked" : self.preferenceClicked, + "on_appListEdit_clicked" : self.appListEditClicked, "on_about_clicked" : self.aboutClicked, "on_convert_clicked" : self.convertClicked, "on_save_clicked" : self.saveClicked, @@ -259,6 +260,12 @@ class LdtpEditorGui (gnome.Program): self.chkListenMouseEvents = self.wTree.get_widget ("chkListenMouseEvents").get_active () self.dlgPreferences.hide () + def appListEditClicked (self, widget): + appDlg = appListEdit (self.gladeFilePath) + result, newAppList = appDlg.run () + if result == gtk.RESPONSE_OK: + ldtplib.libldtpcodegen.saveAppList (newAppList) + def aboutClicked (self, widget): self.dlgAbout = self.wTree.get_widget ("dlgAbout") response = self.dlgAbout.run () @@ -361,6 +368,70 @@ class LdtpEditorGui (gnome.Program): else: self.txtPlayOutputView.set_text ('Failure\n\n' + str (traceback.print_exc ())) +class appListEdit: + def __init__ (self, gladePath): + self.gladeFilePath = gladePath + self.wTree = gtk.glade.XML (self.gladeFilePath, "appDlg") + dic = {"on_addApp" : self.addAppClicked, + "on_deleteApp" : self.deleteAppClicked} + self.wTree.signal_autoconnect (dic) + self.appList = ldtplib.libldtpcodegen.getapps () + self.listView = self.wTree.get_widget ("listView") + self.addColumn ("Window Name", 0) + self.listModel = gtk.ListStore (str) + self.listView.set_model (self.listModel) + + def addAppClicked (self, widget): + addDlg = addApp (self.gladeFilePath) + result, newApp = addDlg.run () + if result == gtk.RESPONSE_OK: + self.appList.append (newApp) + self.listModel.append ([newApp]) + + def deleteAppClicked (self, widget): + selection = self.listView.get_selection () + model, selection_iter = selection.get_selected () + if (selection_iter): + app = self.listModel.get_value (selection_iter, 0) + self.wTree = gtk.glade.XML (self.gladeFilePath, "deleteApp") + self.deleteApp = self.wTree.get_widget ("deleteApp") + response = self.deleteApp.run () + if response == gtk.RESPONSE_OK: + self.appList.remove (app) + self.listModel.remove (selection_iter) + self.deleteApp.hide () + + def addColumn (self, title, columnId): + column = gtk.TreeViewColumn (title, gtk.CellRendererText(), text=columnId) + column.set_resizable (True) + column.set_sort_column_id (columnId) + self.listView.append_column (column) + + def run (self): + self.appDlg = self.wTree.get_widget ("appDlg") + self.showApp () + self.result = self.appDlg.run () + self.newAppList = self.appList + self.appDlg.destroy () + return self.result, self.newAppList + + def showApp (self): + for item in self.appList: + self.listModel.append ([item]) + +class addApp: + def __init__ (self, gladePath): + self.gladeFilePath = gladePath + + def run (self): + self.wTree = gtk.glade.XML (self.gladeFilePath, "addApp") + self.addApp = self.wTree.get_widget ("addApp") + self.result = self.addApp.run () + self.enApp = self.wTree.get_widget ("enApp") + self.newApp = self.enApp.get_text () + self.addApp.destroy () + return self.result, self.newApp + try: # we start the app like this... app = LdtpEditorGui () diff --git a/python/ldtpeditor.glade b/python/ldtpeditor.glade index 7e178ad..15f0271 100644 --- a/python/ldtpeditor.glade +++ b/python/ldtpeditor.glade @@ -1,101 +1,77 @@ - - - + + + - - + True LDTP Editor - GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER - False 600 400 - True - False ../icons/ldtp-logo-small.png - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - + True - False - 0 - True - GTK_PACK_DIRECTION_LTR - GTK_PACK_DIRECTION_LTR - True _File True - - True gtk-save + True True - + - True gtk-save-as + True True - + - True - True gtk-quit + True True - + - True _Help True - - True _About True - + @@ -104,149 +80,103 @@ - 0 False False - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 0 - 0 - True - GTK_ORIENTATION_HORIZONTAL GTK_TOOLBAR_BOTH - True - True - True Start / Stop recording gtk-media-record - True - True - False Record - + False - True - True Play recorded script gtk-media-play - True - True - False Play - + False - True - True Save generated code gtk-save - True - True - False Save - + False - True - True Recording preferences gtk-preferences - True - True - False Preferences - + False - True - True Convert code to ldtprunner format gtk-convert - True - True - False Convert - + False - True - 0 False False + 1 - True True - True - True - GTK_POS_TOP - False - False - True @@ -254,69 +184,36 @@ GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT ScrolledWindow - True - Recorded code text view True True GDK_EXTENSION_EVENTS_ALL - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - + Recorded code text view Recorded code - - False - True - - True Recorded Code - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 Recorded Code tab + False - True @@ -324,26 +221,11 @@ GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - True - Generated LDTP code text view True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - + Generated LDTP code text view Generated LDTP code @@ -351,34 +233,20 @@ - False - True + 1 - True Generated LDTP Code - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 tab + 1 + False - True @@ -386,26 +254,11 @@ GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - True - Generated LDTP XML True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - + Generated LDTP XML Generated LDTP XML @@ -413,41 +266,25 @@ - False - True + 2 - True Generated LDTP XML - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 tab + 2 + False - 0 - True - True + 2 - True @@ -455,27 +292,14 @@ GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - 10 True - Play Output True + Play Output False - False False - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - PlayOutput Play Output @@ -484,307 +308,487 @@ - 0 - True - True + 3 - True - True statusbar - 0 False - True + 4 - - - + + Preferences - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER_ON_PARENT - True False - False + True + GTK_WIN_POS_CENTER_ON_PARENT gtk-preferences - True - False - False GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_CENTER - True - False - True Preferences - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - - True - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - - 0 - False - True - GTK_PACK_END - - - True - False - 0 - True - Listen for keyboard events True + Listen for keyboard events Listen _key events True - GTK_RELIEF_NORMAL - True - False - False + 0 True Listen key events - + - 0 False False - True - Listen for mouse events True + Listen for mouse events Listen _mouse events True - GTK_RELIEF_NORMAL - True - False - False + 0 True Listen mouse events - + - 0 False False + 1 - True - Generate LDTP code in ldtprunner format True + Generate LDTP code in ldtprunner format Generate LDTP _code True - GTK_RELIEF_NORMAL - True - False - False + 0 True Generate LDTP code - + - 0 False False + 2 - True - Generate data XML True + Generate data XML Generate data _XML True - GTK_RELIEF_NORMAL - True - False - False + 0 True GenerateDataXml - + - 0 False False + 3 - True - Generate keyboard events code True + Generate keyboard events code Generate keyboard _events code True - GTK_RELIEF_NORMAL - True - False - False + 0 True GenerateKeyEvents - + - 0 False False + 4 - True - Generate wait time code True + Generate wait time code Generate _wait time code True - GTK_RELIEF_NORMAL - True - False - False + 0 True GenerateWaitTime - + - 0 False False + 5 - True - Generate Memory / CPU statistics True + Generate Memory / CPU statistics Generate Memory / CPU _statistics True - GTK_RELIEF_NORMAL - True - False - False + 0 True GenerateMemCPUstat - + - 0 False False + 6 + + + True + True + True + Edit App List + 0 + - 0 - True - True + 7 + + 2 + - - - + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + -6 + + + + + + True + True + True + True + gtk-ok + True + -5 + + + + 1 + + + + + False + GTK_PACK_END + + + + + + 5 True - LDTP Editor + GDK_WINDOW_TYPE_HINT_NORMAL Copyright 2008 Nagappan Alagappan Linux Desktop (GUI Application) Testing Project - This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - True http://ldtp.freedesktop.org Linux Desktop (GUI Application) Testing Project + This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. A. Nagappan <nagappan@gmail.com> Thanumalayan <madthanu@gmail.com> -Vinod Kumar <vinod.gre@gmail.com> +Vinod Kumar <vinod.gre@gmail.com> +Shreyank Gupta <shreyankg@gmail.com> Nagappan A <nagappan@gmail.com> Premkumar J <prem.jothimani@gmail.com> translator-credits ../icons/ldtp-logo-small.png - - + True + + + + + + + False + GTK_PACK_END + + + + + + + 5 + Supported Applications + GTK_WIN_POS_CENTER_ON_PARENT + GDK_WINDOW_TYPE_HINT_DIALOG + + + True + 2 + + + True + + + True + + + True + gtk-add + + + + False + + + + + True + gtk-delete + + + + False + + + + + False + + + + + True + True + True + + + 1 + + + + + 2 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + -6 + + + + + True + True + True + gtk-ok + True + -5 + + + 1 + + + + + False + GTK_PACK_END + + + + + + + 5 + Add + GTK_WIN_POS_CENTER_ON_PARENT + GDK_WINDOW_TYPE_HINT_DIALOG + + + True + 2 + + + True + + + True + Enter Window Name + + + + + True + True + + + 1 + + + + + 1 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + -6 + + + + + True + True + True + gtk-ok + True + -5 + + + 1 + + + + + False + GTK_PACK_END + + + + + + + 5 + Delete + GTK_WIN_POS_CENTER_ON_PARENT + GDK_WINDOW_TYPE_HINT_DIALOG + + + True + 2 + + + True + Are you sure you want to delete? + + + 1 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + -6 + + + + + True + True + True + gtk-ok + True + -5 + + + 1 + + + + + False + GTK_PACK_END + + + + + diff --git a/python/ldtplib/ChangeLog b/python/ldtplib/ChangeLog index 700f17e..d258f84 100644 --- a/python/ldtplib/ChangeLog +++ b/python/ldtplib/ChangeLog @@ -1,3 +1,9 @@ +2008-07-11 Shreyank Gupta + + * libldtpcodegen.py: Added modules getapps (), saveAppList (), + and wildcard () to implement wildcard feature for user defined + window support and a few global variables to help. + 2008-07-01 Nagappan A * ldtplibutils.py (startInternalLog): Fixed indentation issue. diff --git a/python/ldtplib/libldtpcodegen.py b/python/ldtplib/libldtpcodegen.py index 043ffae..b872235 100644 --- a/python/ldtplib/libldtpcodegen.py +++ b/python/ldtplib/libldtpcodegen.py @@ -42,6 +42,11 @@ from xml.dom.minidom import * from xml.parsers.expat import ExpatError from xml.sax import saxutils +#Wildcard Specific Globals +appList = [] +APPHOME = "%s/.ldtp" % os.environ['HOME'] +APPROOT = "/usr/share/ldtp" + # Let us not register our application under at-spi application list os.environ ['GTK_MODULES'] = '' @@ -636,6 +641,51 @@ def addWait (callbackFunc, timeElapsed): except ValueError: pass +#Wildcard specific function... Get applist +def getapps (): + appList = [] + path = "%s/appdata" % APPHOME + if os.path.exists (path): + appListPath = path + else: + print "Home copy not available" + path = "%s/appdata" % APPROOT + if os.path.exists (path): + appListPath = path + else: + print "Even root copy not available" + return appList + f = open (appListPath) + for item in f: + appList.append (item.strip ()) + f.close () + return appList + +#Wildcard specific function... Replace with wildcards +def wildcard (str): + global appList + if len (appList) == 0: + print "Reading Data from file" + appList = getapps () + for item in appList: + regex= '\"\S*?%s\S*?\"' % item + item = '\"*%s*\"' % item + str = re.compile (regex).sub (item, str, 1) + return str + +#Wildcard specific function... Save applist +def saveAppList (newAppList): + global appList + appList = newAppList + path = "%s/appdata" % APPHOME + if os.path.exists (APPHOME) == False: + os.mkdir (APPHOME, 0755) + f = open (path, 'w') + for item in appList: + item = "%s\n" % item + f.write (item) + f.close () + def callback (guiCallbackFunc, data, timeElapsed = None): global generatedCode if timeElapsed is not None: @@ -654,6 +704,8 @@ def callback (guiCallbackFunc, data, timeElapsed = None): tmpData = "\\n" data = "%s%s%s" % (data, tmpLine, tmpData) data += "\n" + #get Windownames replaced by wildcards here + data = wildcard (data) generatedCode += data guiCallbackFunc (data)