Page 1 of 2
[Solved] Troubleshooting Addon UI Elements
Posted: Wed Aug 24, 2011 1:17 pm
by twohot
My extension installs consistently now, thanks to Hanya as per the thread:
http://user.services.openoffice.org/en/ ... 45&t=43398
The learning Continues. Now the new issues are with UI's. I have 6 submenu items on the TopMenu added by the Extension. The commands execute as expected though the order of the URL is disorderly (not as scripted). There's gotta be a way to tell OOo/LibO how to arrange/order the URLs. Secondly, I added more lines to
Addon.xcu hoping to achieve a toolbar. I see none!
Code: Select all
1 <node oor:name="OfficeToolBar">
2 <node oor:name="org.openoffice.twohot.addon" oor:op="replace">
3 <node oor:name="theExtension_bttnDoit">
4 <prop oor:name="URL" oor:type="xs:string">
5 <value>vnd.sun.star.script:theExtension.oxt|package|theMacros.py$Doit?language=Python&location=user:uno_packages</value>
6 </prop>
7 <prop oor:name="Title" oor:type="xs:string">
8 <value/>
9 <value xml:lang="en-US">Do Something</value>
10 </prop>
11 <prop oor:name="Target" oor:type="xs:string">
12 <value>_self</value>
13 </prop>
14 <prop oor:name="Context" oor:type="xs:string">
15 <value>com.sun.star.sheet.SpreadsheetDocument</value>
16 </prop>
17 </node>
18 </node>
19 </node>
Re: Troubleshooting Addon UI Elements
Posted: Wed Aug 24, 2011 2:06 pm
by hanya
twohot wrote:Now the new issues are with UI's. I have 6 submenu items on the TopMenu added by the Extension. The commands execute as expected though the order of the URL is disorderly (not as scripted). There's gotta be a way to tell OOo/LibO how to arrange/order the URLs.
From
http://wiki.services.openoffice.org/wik ... dOns/Menus :
About oor:name ... A configuration set cannot guarantee the order of its entries, so you should use a schema such as string + number, for example “m1”, as the name is used to sort the entries.
twohot wrote:Secondly, I added more lines to Addon.xcu hoping to achieve a toolbar. I see none!
Try:
Code: Select all
3 <node oor:name="theExtension_bttnDoit" oor:op="replace">
Re: Troubleshooting Addon UI Elements
Posted: Thu Aug 25, 2011 12:14 am
by twohot
Makes sense. I mean the numbered names. Its all showing very well now.
From:
http://user.services.openoffice.org/en/ ... 45&t=43398
Use protocol handler to execute your code and css.frame.XDispatch interface, which allows your button of your toolbar toggle-able
I got the protocol part but I'm lost on the XDispatch. Error message says the handler is passing an argument to my functions which accept nothing. When I adjust the methods to catch those, I find the arg is just zero(0). What is that? Initializing global variables for such functions/methods is also problematic. Error says the variables are being accessed without initialization. This means the protocol handler doesn't see the rest of the macro.
Must I wrap the entire thing into a Class to get things to work?
Re: Troubleshooting Addon UI Elements
Posted: Thu Aug 25, 2011 4:25 am
by hanya
An example:
Code: Select all
import unohelper
from com.sun.star.frame import (XStatusListener,
XDispatchProvider,
XDispatch, XControlNotificationListener, FeatureStateEvent)
from com.sun.star.lang import XInitialization, XServiceInfo
IMPL_NAME = "mytools.frame.PhTest"
class Dispatcher(unohelper.Base, XDispatch, XControlNotificationListener):
def __init__(self, frame):
self.frame = frame
self.state = False
self.listener = None
# XDispatch
def dispatch(self, url, args):
self.state = not self.state
ev = self.create_simple_event(url, self.state)
self.listener.statusChanged(ev)
self.do_something()
def addStatusListener(self, listener, url):
self.listener = listener
def removeStatusListener(self, listener, url): pass
# XControlNotificationListener
def controlEvent(self, ev): pass
def create_simple_event(self, url, state, enabled=True):
return FeatureStateEvent(self, url, "", enabled, False, state)
def do_something(self):
if self.frame:
controller = self.frame.getController()
doc = controller.getModel()
if doc.supportsService("com.sun.star.text.TextDocument"):
doc.getText().setString("New state: %s" % self.state)
class Ph(unohelper.Base, XInitialization, XDispatchProvider, XServiceInfo):
def __init__(self, ctx, *args):
self.frame = None
# XInitialization
def initialize(self, args):
if len(args) > 0:
self.frame = args[0]
# XDispatchProvider
def queryDispatch(self, url, name, flag):
dispatch = None
if url.Protocol == "mytools.frame.Ph:":
try:
dispatch = Dispatcher(self.frame)
except Exception as e:
print(e)
return dispatch
def queryDispatches(self, descs):
pass
# XServiceInfo
def supportsService(self, name):
return (name == "com.sun.star.frame.ProtocolHandler")
def getImplementationName(self):
return IMPL_NAME
def getSupportedServiceNames(self):
return ("com.sun.star.frame.ProtocolHandler",)
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(
Ph,
IMPL_NAME,
("com.sun.star.frame.ProtocolHandler",),)
Re: Troubleshooting Addon UI Elements
Posted: Thu Aug 25, 2011 12:19 pm
by twohot
Seriously, Hanya ... You rock!
Wow! That's a lot of information.

I see a lot of sub-classing happening ...
I don't know why because I've not seen docs on all those classes. I skipped those part in Chapters-2&3 of the Developers Guide:
Professional UNO & Writing UNO Components (was sounding a little high for new LibO scripting enthusiast). Looks like I need to go back and read those bits until it all makes sense. Your code is explanatory but I'd like to know more about the imported classes.
Time to study!
Would have been much fun if the Dev-Guide was written with
Py-Examples
I'll be back
Re: Troubleshooting Addon UI Elements
Posted: Fri Aug 26, 2011 11:55 am
by twohot
Back!
I've been looking at the sample code above (hanya) and the
.xcu files in the attachment. I've also perused the Dev. Guide some more. I think I'm catching on. I am considering the following lines in
ph.oxt|Addons.xcu:
Code: Select all
<node oor:name="mytools.frame.Ph_01" oor:op="replace">
<prop oor:name="URL">
<value>mytools.frame.Ph:ToggleButton</value>
</prop>
<prop oor:name="ControlType">
<value>ToggleButton</value>
</prop>
To my understanding, the
ph.oxt|ProtocolHandler.xcu tells OOo to channel all URLs presided by
'mytools.frame.Ph:' to the Custom Handler in
ph.py. I suspect that your example assumes there is just one button hence the
'mytools.frame.Ph:ToggleButton' in
Addon.xcu as I don't see any ToggleButton() defined (maybe its in the derived class) .... or I'm being a total noob

.
Pardon me please ... I need to understand this gradually. I also see a property called 'ToggleButton' and wonder what other properties there are for UIs. I'm presently trying to see what the urls, and args in some of the methods do ... perhaps they hold the key to deciphering which button is calling a method (hope I'm making sense). Consider the illustration where two UI elements call one function/method in the image below:
What I was trying to say is:
How does one go about allowing both MenuItems and ToolBarItems to share methods?
Re: Troubleshooting Addon UI Elements
Posted: Fri Aug 26, 2011 2:41 pm
by hanya
ControlType of the menu entry is descrived in:
http://wiki.services.openoffice.org/wik ... r_controls
The document was planed to add into DevGuide but it had been cancelled. And the document mentioned above lacks something the way to toggle the buttons.
What I was trying to say is: How does one go about allowing both MenuItems and ToolBarItems to share methods?
It seems you have been read the DevGuide of the protocol handling mechanism of the office.
If you prepare your UNO URL into two position, the one is in the menubar and another in the toolbar, queryDispatch method of your protocol handler is called for each items. You have to return css.frame.XDispatch interface for each call. You can return the same object supports XDispatch interface for both call in this case. Or return an object for each call individually, manage them with its frame which is belonged by the menu and toolbar items. I do not know which way is good.
You can switch the state of the toggle buttons with to call statusChanged method with FeatureStateEvent as its argument for all entries.
Re: Troubleshooting Addon UI Elements
Posted: Fri Aug 26, 2011 7:14 pm
by hanya
Just an example:
Code: Select all
import unohelper
from com.sun.star.frame import (XStatusListener,
XDispatchProvider,
XDispatch, XControlNotificationListener, FeatureStateEvent)
from com.sun.star.lang import (XInitialization,
XServiceInfo, XEventListener)
from com.sun.star.util import XCloseListener
IMPL_NAME = "mytools.frame.PhTest"
class DocumentCloseListener(unohelper.Base, XCloseListener):
""" helps to dispose the frame keeper. """
def __init__(self, parent):
self.parent = parent
# XEventListener
def disposing(self, ev):
self.parent.dispose()
self.parent = None
def queryClosing(self, ev, ownership): pass
def notifyClosing(self, ev): pass
class Dispatcher(unohelper.Base, XDispatch, XControlNotificationListener):
def __init__(self, frame, url):
self.frame = frame
self.state = False
self.listeners = []
self.url = url
# XDispatch
def dispatch(self, url, args):
self.state = not self.state
self.broadcast_state()
self.do_something()
def broadcast_state(self):
ev = self.create_simple_event(self.url, self.state)
self.status_changed(ev)
def status_changed(self, ev):
for listener in self.listeners:
listener.statusChanged(ev)
def addStatusListener(self, listener, url):
try:
self.listeners.find(listener)
except:
self.listeners.append(listener)
self.broadcast_state() # set current state
def removeStatusListener(self, listener, url):
try:
m = self.listeners.find(listener)
self.listeners.pop(n)
except:
pass
# XControlNotificationListener
def controlEvent(self, ev): pass
def create_simple_event(self, url, state, enabled=True):
return FeatureStateEvent(self, url, "", enabled, False, state)
def do_something(self):
if self.frame:
controller = self.frame.getController()
doc = controller.getModel()
if doc.supportsService("com.sun.star.text.TextDocument"):
doc.getText().setString("New state: %s" % self.state)
class FrameKeeper(object):
def __init__(self, frame):
self.frame = frame
self.dispatchers = {}
self.add_document_listener()
def __eq__(self, other):
try:
return self == other or self.frame == other
except:
return False
def add_document_listener(self):
doc = self.frame.getController().getModel()
doc.addCloseListener(DocumentCloseListener(self))
def dispose(self):
self.frame = None
self.dispatchers.clear()
_remove_keeper(self)
def add(self, url, value):
""" add dispatcher. """
dispatcher = self.dispatchers.get(url, None)
if dispatcher is None:
self.dispatchers[url] = value
def get(self, url):
return self.dispatchers.get(url, None)
class FrameContainer(object):
""" keeps FrameKeepers. """
def __init__(self):
self.items = []
def _find(self, value):
i = 0
for item in self.items:
if item == value :
return i
i += 1
raise KeyError()
def add(self, keeper):
try:
self._find(keeper)
except:
self.items.append(keeper)
def remove(self, keeper):
try:
n = self._find(keeper)
self.items.pop(n)
except:
pass
def get(self, value):
try:
n = self._find(value)
return self.items[n]
except:
raise
# keeps all frames as wrapped objects
_frames = FrameContainer()
def _remove_keeper(keeper):
_frames.remove(keeper)
def _add_dispatcher(frame, url):
""" find frame keeper or create it if not found. """
dispatcher = None
try:
item = _frames.get(frame)
dispatcher = item.get(url.Main)
except:
item = FrameKeeper(frame)
_frames.add(item)
if dispatcher is None:
dispatcher = _create_dispatcher(frame, url)
item.add(url.Main, dispatcher)
return dispatcher
def _create_dispatcher(frame, url):
dispatcher = None
if url.Main == "mytools.frame.Ph:ToggleButton":
dispatcher = Dispatcher(frame, url)
return dispatcher
class Ph(unohelper.Base, XInitialization, XDispatchProvider, XServiceInfo):
def __init__(self, ctx, *args):
self.frame = None
# XInitialization
def initialize(self, args):
if len(args) > 0:
self.frame = args[0]
# XDispatchProvider
def queryDispatch(self, url, name, flag):
dispatch = None
if url.Protocol == "mytools.frame.Ph:":
try:
dispatch = _add_dispatcher(self.frame, url)
except Exception as e:
print(e)
return dispatch
def queryDispatches(self, descs):
pass
# XServiceInfo
def supportsService(self, name):
return (name == "com.sun.star.frame.ProtocolHandler")
def getImplementationName(self):
return IMPL_NAME
def getSupportedServiceNames(self):
return ("com.sun.star.frame.ProtocolHandler",)
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(
Ph, IMPL_NAME, ("com.sun.star.frame.ProtocolHandler",),)
Edit: FrameKeeper.__eq__ has problem on Python 3, it should be as follows: Code: Select all class FrameKeeper(object):
# ...
def __eq__(self, other):
try:
return self.frame == other.frame
except:
return False
|
Re: Troubleshooting Addon UI Elements
Posted: Tue Sep 06, 2011 8:12 pm
by twohot
Frustration!
When I tweak
ph3.oxt above I get a functioning extension. For some weird reason, changing the name symbols (i.e
mytools.frame.PhTest to say ...
twohot.frame.protocols) gives me no extension. Installation goes well but I get nothing. No TopMenu, no Toolbar. Sure, I adapted
Addon.xcu and
ProtocolHandler.xcu to match. I was also trying to make the Handler accept parameters like the one in Wavelet Example (
twohot.frame.Ph:ToggleButton?useIt - where
useit is a parameter). The tweak works on Ph3.oxt but as I can't see any feedback from my adapted version,
Its hard to say. Without the tweak, the example ties the Protocol Handler to only togglebutton URLs. This was not what I had in mind.
Here is a snip of the tweak:
Code: Select all
# XDispatch
def dispatch(self, url, args):
if url.Path[:13]=='ToggleButton?':
self.state = not self.state
self.broadcast_state()
task = url.Path[13:]
else:
task = url.Path
print task
self.doThis(task)
With the above I can extract parameters and implement logical branching at
self.doThis(task). This might be crude ... suggestions welcome, like what the args being passed around are for. I get empty strings for those.
Re: Troubleshooting Addon UI Elements
Posted: Wed Sep 07, 2011 7:45 am
by hanya
Try, you have to parse url passed to methods:
Code: Select all
mytools.frame.Ph:ToggleButton?Arg:string=useIt
twohot wrote:For some weird reason, changing the name symbols (i.e mytools.frame.PhTest to say ...twohot.frame.protocols) gives me no extension. Installation goes well but I get nothing. No TopMenu, no Toolbar. Sure, I adapted Addon.xcu and ProtocolHandler.xcu to match.
It seems your Addons.xcu is wrong. Because it works without ProtocolHandler.xcu.
Re: Troubleshooting Addon UI Elements
Posted: Wed Sep 07, 2011 11:07 am
by twohot
hanya wrote:Try, you have to parse url passed to methods:
Code: Select all
mytools.frame.Ph:ToggleButton?Arg:string=useIt
Argh! I see
no special benefit with the extra
'Arg:string=useIt' in the URL. I still get empty
arg strings. When I print out the URL from within the dispatcher I get:
Code: Select all
(com.sun.star.util.URL){ Complete = (string)"twohot.frame.Ph:ToggleButton?Arg:string=attendance", Main = (string)"twohot.frame.Ph:ToggleButton?Arg:string=attendance", Protocol = (string)"twohot.frame.Ph:", User = (string)"", Password = (string)"", Server = (string)"", Port = (short)0x0, Path = (string)"ToggleButton?Arg:string=attendance", Name = (string)"", Arguments = (string)"", Mark = (string)"" }
So what is the use? All the dictionary keys point to full URLs or path thereof but none has the value of 'useit'. The args print:
Code: Select all
((com.sun.star.beans.PropertyValue){ Name = (string)"Referer", Handle = (long)0x0, Value = (any){ (string)"private:user" }, State = (com.sun.star.beans.PropertyState)DIRECT_VALUE },)
That, also, doesn't say much. With string slicing, I was able to extract what I needed from 'twohot.frame.Ph:ToggleButton?attendance'. Something still tells me it is crude ... there may be an official/traditional way as planned by LibO/OOo designers. I dont know.
I found the problem with the Extension. The implementation names didn't match that in the python code. Sloppy work

. Now, the new challenge is I get
two toolbars!!!!

One with things as expected and the other with nothing.
Where did that come from? I also removed __create__dispatcher() function. It appears somewhat redundant since a line in the parent method will suffice. I wanted a way to use the Protocol Handler for two types of buttons (toggle and normal ones). To achieve that I adjusted the code to watch for url.protocol only and not url.main. The rest is sorted out internally as shown in my previous post. Testing & Branching is happening at the class method 'do_something()'. Its all working for now. I am wondering if the syntax for g_ImplementationHelper.addImplementation() allows the addition of more implementations in one statement. I have an XModifyListener implemented here and I'm trying to merge that into the Extension. Do I need to tell LibO/OOo (via some kind of .xcu file) that this exists? Thinking aloud.

Does g_exportedScripts work for python extensions or is that limited to macros? I want to trigger that listener when the document is loaded. Is it not better to store a copy of the Document (context) in a global variable accessible to the extension methods or is it wiser to be fetching it via the controller at each call? I'm just wondering.
Wow. Generally, there is progress today.
Thanks Hanya
Re: Troubleshooting Addon UI Elements
Posted: Wed Sep 07, 2011 2:30 pm
by hanya
Argh! I see no special benefit with the extra 'Arg:string=useIt' in the URL. I still get empty arg strings. When I print out the URL from within the dispatcher I get:
Highly depends on the internal implementation, I have seen a component which parses parameters and passes it to dispatch method.
I get two toolbars!!!!
It seems your profile broken. I suppose you to work on a profile for development. I have met sometimes breaking my profile on version 3.0, 3.1 or older. Most of the situation are installation and un-installation of extensions having problem inside.
I am wondering if the syntax for g_ImplementationHelper.addImplementation() allows the addition of more implementations in one statement.
Read pythonloader.py to understand well.
Do I need to tell LibO/OOo (via some kind of .xcu file) that this exists?
I do not think so.
Does g_exportedScripts work for python extensions or is that limited to macros?
It works only for Python scripts and it manages only UI element.
I want to trigger that listener when the document is loaded.
Consider to execute your code by events. Its hard to implement correctly.
Is it not better to store a copy of the Document (context) in a global variable accessible to the extension methods or is it wiser to be fetching it via the controller at each call? I'm just wondering.
It depends on your style. The UNO components are part of the office.
Re: Troubleshooting Addon UI Elements
Posted: Wed Sep 07, 2011 6:16 pm
by twohot
hanya wrote:It seems your profile broken. I suppose you to work on a profile for development. I have met sometimes breaking my profile on version 3.0, 3.1 or older. Most of the situation are installation and un-installation of extensions having problem inside.
Deleted my Profile and got myself a new one. Nope, its still there ... one with 'Addon-1' label and another with nothing ... blank, but messes up the workspace/UI. I am suspecting
CalcWindowState.xcu. Button images are also not responding. Looks like the _26.bmp suffixes are mandatory. I gotta check that ... Hmm
Re: Troubleshooting Addon UI Elements
Posted: Thu Sep 15, 2011 1:03 pm
by twohot
I presented my LibO extension on Thurday 8, 2011 last week. My colleagues at School (lecturers) found it very helpful. That means, it was a success! Thanks to Hanya ... I would have done it without him. I'm back to tweaking since I have to produce documentation to back the extension. I'm creating custom icons for the toolbar. I find that LibO supports PNGs through the 'image' customization branch. Sounds attractive because creating icons with magenta backgrounds for transparencies makes for restricted art. I get pinkish outlines because of anti-aliasing using 'imageidentifier'. Problem is: I cant get the 'image' branch to work. Once I tweak Addon.xcu, i'm back to text on those buttons. This is where I have a problem with LibO/OOo documentation
Re: Troubleshooting Addon UI Elements
Posted: Thu Sep 15, 2011 1:38 pm
by hanya
You'er welcome.
I get pinkish outlines because of anti-aliasing using 'imageidentifier'. Problem is: I cant get the 'image' branch to work.
ImageIdentifier supports only BMP file but UserDefinedImages allows to use PNG image as an icon, see:
http://wiki.services.openoffice.org/wik ... _and_Menus
Re: Troubleshooting Addon UI Elements
Posted: Thu Sep 15, 2011 2:33 pm
by twohot
Hello Hanya. I've read that page like ....5 times or thereabout. Looks like the 'images' and 'UserDefinedImages' nodes exist outside the 'OfficeToolbar' tree. Is that correct? If so, i expect that LibO/OOo has a way of linking the elements to those with identical URLs in OfficeToolBar ... else I'm lost. I tried adapting the example to my scenario and lost the existing icon altogether. Let me use this opportunity to inform you about my makeshift solution to the event triggered listener.
Summary: It didnt work
At the moment, I'm going through the menus (tools -> macros -> run macros -> my Macros -> myExtension.oxt -> startListener()). That partially defeats the purpose of ease for my extension ... an my friends kept wondering if that could be avoided. Since I wasn't equipped to implement an event triggered listener via python extension framework, I took the scripting framework path (only for the listener) and exported the starting method. I get errors when I connect that method to a 'Document Loaded' event. The event passes an argument to the method and I'm blank about this argument. That's by-the-way ... right now, I'm more concerned about getting my toolbar look good so i can produce screenshots for documentation. I'll look into the event triggered bit later.
Re: Troubleshooting Addon UI Elements
Posted: Thu Sep 15, 2011 5:51 pm
by hanya
Looks like the 'images' and 'UserDefinedImages' nodes exist outside the 'OfficeToolbar' tree. Is that correct?
Correct. Your original node should be there under /org.openoffice.Office.Addons/AddonUI/Images. UserDefinedImages node defines an image resource which is bound to specific URL. If the URL is there in the menubar or toolbar of the application, it is shown as its icon image.
Re: Troubleshooting Addon UI Elements
Posted: Thu Sep 15, 2011 6:14 pm
by twohot
hanya wrote:If the URL is there in the menubar or toolbar of the application, it is shown as its icon image.
Thats what I thought. Just that, its not working here. I'll try it again.
Re: Troubleshooting Addon UI Elements
Posted: Thu Sep 22, 2011 3:41 am
by twohot
I've just migrated to LibO 3.4 for Fedora GNU/Linux (15) since that's the version for productivity scenarios. Everything works as before here in Linux -- as per this extension thread. Strangely, the result is different for LibO 3.4 in Windows. In Windows, the icons on the add-on toolbar does not work. Instead, text is displayed. What could be causing this? Is there a Windows-specific precaution for extension developers to take note of?
Re: Troubleshooting Addon UI Elements
Posted: Thu Sep 22, 2011 4:05 am
by hanya
Hmm, If you can give me your package, I can try to find your problem easily.
Re: Troubleshooting Addon UI Elements
Posted: Thu Sep 22, 2011 3:07 pm
by twohot
hanya wrote:Hmm, If you can give me your package, I can try to find your problem easily.
Aaah! Spotted the problem.
Windows starts with its GUI icon view set to
'small' whereas my package only implements the 26x26px icons. It looks correct when I set LibO to show large icons in Windows. I'm creating 16x16px icons now.
There's only one major thing left: figuring out how to make the
'Document Loaded' event trigger my cell listener.
Re: Troubleshooting Addon UI Elements
Posted: Thu Sep 22, 2011 3:55 pm
by hanya
There's only one major thing left: figuring out how to make the 'Document Loaded' event trigger my cell listener.
I have made a simple job example for context menu interceptor registered on OnNew and OnLoad event:
http://user.services.openoffice.org/en/ ... 15#p123613
Should be refered:
http://wiki.services.openoffice.org/wik ... figuration
Re: Troubleshooting Addon UI Elements
Posted: Thu Sep 22, 2011 8:35 pm
by twohot
I wish there is an IRC channel for macro developers ... there are questions. Some of them may be basic but answers to them are invaluable and will help future newbies (as I plan to document my experience with LibO/OOo on macro/extension development)
Re: Troubleshooting Addon UI Elements
Posted: Thu Sep 22, 2011 9:31 pm
by twohot
hi Hanya.
In the attached ctmp.oxt.zip in
this thread you created a class
JobExecutor by subclassing
XJob and
Unohelper.Base. I am curious as to why a custom
JobExecutor had to be made since there is an
XJobExecutor class in
com.sun.star.task.
Re: Troubleshooting Addon UI Elements
Posted: Fri Sep 23, 2011 4:56 am
by hanya
Because Job mechanism can execute jobs which supports css.task.XJob interface. execute method of XJob interface can take additional arguments which specified in the configuration.
twohot wrote:I wish there is an IRC channel for macro developers ... there are questions.
There are people in here make answer in their spare time. There are limited number of people can make answer for you depends on the kind of your problem. But you can find some information in this forum using search feature.
You may get more response in developer's mailing-list or maybe IRC if it is there.
Re: Troubleshooting Addon UI Elements
Posted: Fri Sep 23, 2011 5:16 am
by twohot
hanya wrote:There are limited number of people can make answer for you depends on the kind of your problem.
How true, Thanks
I'm reading about Jobs. I'd appreciate a layman's comparison between synchronous and Asynchronous jobs. The JobExecutor can handle both. Under what scenario is one preferred over the other?
Re: Troubleshooting Addon UI Elements
Posted: Fri Sep 23, 2011 7:18 pm
by twohot
Hmm, So I came up with a hack ...
a faulty hack; the type where you download on-line samples and stitch! This one seems to be dirty.

The Job section works though. Just make sure the loaded document has a custom property named 'USE_ME' with a boolean value of 'Yes' and you should get appropriate echoes on the terminal. However, the bit that attaches a listener to cell A1 remains a mystery. I get no error messages whatsoever but A1 gets no listener albeit. Maybe someone can point out my folly

Re: Troubleshooting Addon UI Elements
Posted: Sat Sep 24, 2011 3:45 pm
by hanya
Use getCellByPosition method to get cell object, getCellRangeByName method returns cell range object. And the argument of modified method does not have Value member.
Edit: Striked part is not true. |
Re: Troubleshooting Addon UI Elements
Posted: Sat Sep 24, 2011 3:54 pm
by twohot
hanya wrote: And the argument of modified method does not have Value member.
Agreed. Sorry the following snip of the Listener is wrong:
Code: Select all
def modified(self, oEv):
print oEv.Value
it should read:
Code: Select all
def modified(self, oEv):
print(oEv.Source.Value)
Re: Troubleshooting Addon UI Elements
Posted: Sat Sep 24, 2011 3:58 pm
by twohot
Wow ... it works. So what did I miss initially?