View Issue Details

IDProjectCategoryView StatusLast Update
0001629ScribusScripterpublic2014-06-05 21:39
Reportersjc Assigned Tocbradney  
PrioritylowSeverityfeatureReproducibilityalways
Status closedResolutionno change required 
Product Version1.3.1cvs 
Target VersionFixed in Version 
Summary0001629: A need to run menu items from the scriptor for automation purposes
DescriptionWhen writing scripts it is currently not possible to access any of the items available from the menus. This would be a desirable feature for automation purposes.
Additional InformationPossibly include a "macro recorder" too that could automatically record a set of user actions and build a basic script for the user to edit further or use.

Consider how any of this be handled when menu text can be in different languages. The menu items would be tricky to call by name if the menu names cannot always be guaranteed to be consistent, unless the underlying menu functions had their own scriptor name. Otherwise we would end up with scripts that would only run in their originating language.

TagsNo tags attached.
Patch

Relationships

child of 0003813 acknowledged Metabug: Scripter 

Activities

ringerc

2005-02-03 11:07

reporter   ~0003599

This should be reasonably easy to do using Craig Bradney's QAction conversion work. Never say easy until it's done ... I know, I know.

Language will not be an issue, as the internal QAction name will be used not its translated name. I'm pretty sure functions could be provided to discover the available actions, what menus they're in, etc.

Macro recording is in my opinion a separate issue and I don't intend to address it here. Something like that could be built on Tsoots undo framework, and I think there may already be plans in that direction.

sjc

2005-02-03 11:57

developer   ~0003600

also see bug 0001630: A macro recorder to build a script automatically from users actions

ringerc

2005-07-05 15:27

reporter   ~0005398

In theory, you should be able to do something like:

qt.qApp.mainWidget().queryList("QObject", "fileSaveAs")[0]

from PyQt. In reality, this returns a QObject (rather than the QAction it should, given that QAction is the lowest known base class of ScrAction) which is essentially useless, since you can't dynamic_cast it. It's possible to trigger the action, but you must do it by building an object, connecting a slot on the returned QObject to a signal on your temporary object, then firing that signal. Tedious, huh?

That said, with Craig Bradney's work on actions it should be possible to trigger any action from the scripter using a little bit of C++ code. I'm not sure how useful this is without the ability to move the mouse (or trigger fake events) etc though.

h_a_j_s

2005-07-05 19:04

developer   ~0005400

Actually with newer PyQt/sip-snapshots (starting from july) casting objects works as expected.

Now you can do
  action = qt.qApp.mainWidget().queryList("QAction", "helpAboutScribus")[0]
  action.activate()

It works really great.

Issue History

Date Modified Username Field Change
2005-02-03 09:14 sjc New Issue
2005-02-03 10:58 ringerc Status new => assigned
2005-02-03 10:58 ringerc Assigned To => ringerc
2005-02-03 11:07 ringerc Note Added: 0003599
2005-02-03 11:57 sjc Note Added: 0003600
2005-04-08 01:58 ringerc Priority normal => low
2005-04-08 01:58 ringerc Product Version => 1.3.0cvs
2005-07-05 15:27 ringerc Note Added: 0005398
2005-07-05 19:04 h_a_j_s Note Added: 0005400
2005-07-10 02:40 ringerc Product Version 1.3.0cvs => 1.3.1cvs
2006-05-13 21:33 christoph_s Relationship added child of 0003813
2008-03-14 06:59 ringerc Assigned To ringerc =>
2008-03-14 06:59 ringerc Status assigned => acknowledged
2014-06-05 21:39 cbradney Status acknowledged => closed
2014-06-05 21:39 cbradney Assigned To => cbradney
2014-06-05 21:39 cbradney Resolution open => no change required