本文整理汇总了Python中uno.invoke函数的典型用法代码示例。如果您正苦于以下问题:Python invoke函数的具体用法?Python invoke怎么用?Python invoke使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了invoke函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: generateTestPropertyValues
def generateTestPropertyValues(self, count):
sm = self.context.ServiceManager
values = sm.createInstanceWithContext("com.sun.star.document.IndexedPropertyValues", self.context)
for i in range(count):
properties = (PropertyValue(Name='n'+str(i), Value='v'+str(i)),)
uno.invoke(values, "insertByIndex", (i, uno.Any("[]com.sun.star.beans.PropertyValue", properties)))
return values
开发者ID:CloCkWeRX,项目名称:core,代码行数:7,代码来源:testcollections_XIndexContainer.py
示例2: updateData
def updateData(self):
useUno = False
try:
try:
data = getattr(self._dataObject, self._field)
except Exception:
useUno = True
data = uno.invoke(self._dataObject, "get" + self._field, ())
ui = self.getFromUI()
if data is not ui:
if isinstance(ui,Date):
d = datetime(ui.Year, ui.Month, ui.Day)
ui = d.strftime('%d/%m/%y')
elif isinstance(ui,Time):
t = datetime(1, 1, 1, ui.Hours, ui.Minutes)
ui = t.strftime('%H:%M')
if useUno:
uno.invoke(self._dataObject, "set" + self._field, (ui,))
else:
if isinstance(ui,tuple):
#Listbox Element
ui = ui[0]
setattr(self._dataObject, self._field, ui)
except Exception:
traceback.print_exc()
开发者ID:chrissherlock,项目名称:libreoffice-experimental,代码行数:25,代码来源:DataAware.py
示例3: actionPerformed
def actionPerformed (self, actionEvent):
try:
if self.xRB_m.getState():
self.sSelectedDic = 'moderne'
elif self.xRB_c.getState():
self.sSelectedDic = 'classique'
elif self.xRB_r.getState():
self.sSelectedDic = 'reforme1990'
elif self.xRB_t.getState():
self.sSelectedDic = 'toutesvariantes'
else:
# no dictionary selected
pass
if self.sSelectedDic and self.sSelectedDic != self.sCurrentDic :
# Modify the registry
xSettings = helpers.getConfigSetting("/org.openoffice.Office.Linguistic/ServiceManager/Dictionaries/HunSpellDic_fr", True)
xLocations = xSettings.getByName("Locations")
v1 = xLocations[0].replace(self.sCurrentDic, self.sSelectedDic)
v2 = xLocations[1].replace(self.sCurrentDic, self.sSelectedDic)
#xSettings.replaceByName("Locations", xLocations) # doesn't work, see line below
uno.invoke(xSettings, "replaceByName", ("Locations", uno.Any("[]string", (v1, v2))))
xSettings.commitChanges()
self.xContainer.endExecute()
except:
traceback.print_exc()
开发者ID:mrmen,项目名称:machange,代码行数:25,代码来源:DictionarySwitcher.py
示例4: removeMenuItem
def removeMenuItem( self, documenttype, command, submenu = False ):
aUIMgr = self.ctx.ServiceManager.createInstanceWithContext( 'com.sun.star.ui.ModuleUIConfigurationManagerSupplier', self.ctx )
xUIMgr = aUIMgr.getUIConfigurationManager( documenttype )
settings = xUIMgr.getSettings( 'private:resource/menubar/menubar', True )
def findCommand( items, command ):
for i in range( items.getCount() ):
menu = unprops( items.getByIndex( i ) )
if 'CommandURL' in menu and menu.CommandURL == command:
return items, i + 1
if 'ItemDescriptorContainer' in menu and menu.ItemDescriptorContainer:
container, index = findCommand( menu.ItemDescriptorContainer, command )
if container is not None:
return container, index
return None, None
if submenu or ':' in command:
url = command
else:
url = self.commandURL( command )
container, index = findCommand( settings, url )
while container is not None:
uno.invoke( container, 'removeByIndex', (index-1,) )
container, index = findCommand( settings, url )
xUIMgr.replaceSettings( 'private:resource/menubar/menubar', settings)
xUIMgr.store()
开发者ID:KAMI911,项目名称:loec,代码行数:27,代码来源:extensioncore.py
示例5: tstDoc
def tstDoc(self):
try:
props = [("ReadOnly", True)]
loadProps = tuple([self.mkPropertyValue(name, value) for (name, value) in props])
m_xMSF = self.xContext.ServiceManager
desktop = m_xMSF.createInstanceWithContext('com.sun.star.frame.Desktop', self.xContext)
filepath = os.path.abspath("FIXME")
if os.name == "nt":
sourceFile = "file:///" + filepath + "/" + quote(self.fileName)
else:
sourceFile = "file://" + quote(filepath) + "/" + quote(self.fileName)
self.xDoc = desktop.loadComponentFromURL(sourceFile ,"_blank", 0 , loadProps)
assert(self.xDoc)
if os.name == "nt":
targetFile = "file:///" + self.m_TargetDir + quote(self.m_SourceDir) + "/" + quote(self.fileName)
else:
targetFile = "file://" + quote(self.m_TargetDir) + quote(self.m_SourceDir) + "/" + quote(self.fileName)
p1 = PropertyValue()
PropValue = uno.Any("[]com.sun.star.beans.PropertyValue", (p1,))
uno.invoke(self.xDoc, "storeToURL", (targetFile, PropValue))
except Exception:
raise
开发者ID:TrTLE,项目名称:core,代码行数:27,代码来源:load_save_test.py
示例6: testInvoke
def testInvoke( self ):
self.failUnless( 5 == uno.invoke( self.tobj , "transportAny" , (uno.Any("byte", 5),) ) )
self.failUnless( 5 == uno.invoke(
PythonTransporter(), "transportAny" , (uno.Any( "byte", 5 ),) ) )
t = uno.getTypeByName( "long" )
mystruct = uno.createUnoStruct(
"com.sun.star.beans.PropertyValue", "foo",0,uno.Any(t,2),0 )
mystruct.Value = uno.Any(t, 1)
开发者ID:Flatta,项目名称:LibreOffice-core,代码行数:8,代码来源:core.py
示例7: breakLinkOfTextSection
def breakLinkOfTextSection(self, oTextSection):
try:
oSectionLink = \
uno.createUnoStruct('com.sun.star.text.SectionFileLink')
oSectionLink.FileURL = ""
uno.invoke(oTextSection, "setPropertyValues",
(("FileLink", "LinkRegion"), (oSectionLink, "")))
except Exception:
traceback.print_exc()
开发者ID:LibreOffice,项目名称:core,代码行数:9,代码来源:TextSectionHandler.py
示例8: addControl
def addControl(self, sAwtName, sControlName, dProps):
oControlModel = self.DialogModel.createInstance("com.sun.star.awt.UnoControl" + sAwtName + "Model")
while dProps:
prp = dProps.popitem()
uno.invoke(oControlModel, "setPropertyValue", (prp[0], prp[1]))
oControlModel.Name = sControlName
self.DialogModel.insertByName(sControlName, oControlModel)
if sAwtName == "Button":
self.DialogContainer.getControl(sControlName).addActionListener(self)
self.DialogContainer.getControl(sControlName).setActionCommand(sControlName + '_OnClick')
return oControlModel
开发者ID:kelsa-pi,项目名称:unodit,代码行数:11,代码来源:simple_dialogs.py
示例9: insertControlModel
def insertControlModel(self, serviceName, componentName, sPropNames, oPropValues):
try:
xControlModel = self.xDialogModel.createInstance(serviceName)
uno.invoke(xControlModel, "setPropertyValues", (sPropNames, oPropValues))
self.xDialogModel.insertByName(componentName, xControlModel)
xControlModel.Name = componentName
except Exception:
traceback.print_exc()
aObj = self.xUnoDialog.getControl(componentName)
return aObj
开发者ID:personal-wu,项目名称:core,代码行数:11,代码来源:UnoDialog.py
示例10: __init__
def __init__(self, ctx, res={}, title=None, ids=(), titles={}, help_url=None):
self.ctx = ctx
self.res = res
self.title = title
self.titles = titles
wizard = self.create_service("com.sun.star.ui.dialogs.Wizard")
uno.invoke(wizard, "initialize", ((uno.Any("[]short", ids), self),))
self.wizard = wizard
if self.title:
wizard.setTitle(self._(title))
if help_url:
wizard.HelpURL = help_url
开发者ID:Koala,项目名称:BookmarksMenu,代码行数:12,代码来源:wizard.py
示例11: printDoc
def printDoc(xContext, xDoc, url):
props = [ mkPropertyValue("FileName", url) ]
# xDoc.print(props)
uno.invoke(xDoc, "print", (tuple(props),)) # damn, that's a keyword!
busy = True
while busy:
print("printing...")
time.sleep(1)
prt = xDoc.getPrinter()
for value in prt:
if value.Name == "IsBusy":
busy = value.Value
print("...done printing")
开发者ID:CaoMomo,项目名称:core,代码行数:13,代码来源:convwatch.py
示例12: setDialogProperties
def setDialogProperties(self, closeable, height, moveable, position_x,
position_Y, step, tabIndex, title, width):
uno.invoke(self.xDialogModel, "setPropertyValues",
((PropertyNames.PROPERTY_CLOSEABLE,
PropertyNames.PROPERTY_HEIGHT,
PropertyNames.PROPERTY_MOVEABLE,
PropertyNames.PROPERTY_POSITION_X,
PropertyNames.PROPERTY_POSITION_Y,
PropertyNames.PROPERTY_STEP,
PropertyNames.PROPERTY_TABINDEX,
PropertyNames.PROPERTY_TITLE,
PropertyNames.PROPERTY_WIDTH),
(closeable, height, moveable, position_x, position_Y, step,
tabIndex, title, width)))
开发者ID:LibreOffice,项目名称:core,代码行数:14,代码来源:WizardDialog.py
示例13: trigger
def trigger (self, args):
try:
dialog = FrenchDictionarySwitcher(self.ctx)
dialog.run()
if dialog.sSelectedDic and dialog.sSelectedDic != dialog.sCurrentDic :
# Modify the registry
xSettings = getConfigSetting("/org.openoffice.Office.Linguistic/ServiceManager/Dictionaries/HunSpellDic_fr", True)
xLocations = xSettings.getByName("Locations")
v1 = xLocations[0].replace(dialog.sCurrentDic, dialog.sSelectedDic)
v2 = xLocations[1].replace(dialog.sCurrentDic, dialog.sSelectedDic)
#xSettings.replaceByName("Locations", xLocations) # doesn't work, see line below
uno.invoke(xSettings, "replaceByName", ("Locations", uno.Any("[]string", (v1, v2))))
xSettings.commitChanges()
except:
traceback.print_exc()
开发者ID:gnodet,项目名称:epubs,代码行数:15,代码来源:DictionarySwitcher.py
示例14: create_index
def create_index(self, anchor=None, index_type='toc', index_name=None,
index_title=''):
"""
com.sun.star.text.DocumentIndex alphabetical index
com.sun.star.text.ContentIndex table of contents
com.sun.star.text.UserIndex user defined index
com.sun.star.text.IllustrationIndex illustrations index
com.sun.star.text.ObjectIndex objects index
com.sun.star.text.TableIndex (text) tables index
com.sun.star.text.Bibliography bibliographical index
level_format = (
(
PropertyValue('TokenType', 0, 'TokenEntryText', DIRECT_VALUE),
PropertyValue('CharacterStyleName', 0, '', DIRECT_VALUE),
),
(
PropertyValue('TokenType', 0, 'TokenTabStop', DIRECT_VALUE),
PropertyValue('TabStopRightAligned', 0, True, DIRECT_VALUE),
PropertyValue('TabStopFillCharacter', 0, ' ', DIRECT_VALUE),
PropertyValue('CharacterStyleName', 0, '', DIRECT_VALUE),
PropertyValue('WithTab', 0, True, DIRECT_VALUE),
),
(
PropertyValue('TokenType', 0, 'TokenPageNumber', DIRECT_VALUE),
PropertyValue('CharacterStyleName', 0, '', DIRECT_VALUE)
),
)
# these two lines are a work around for bug #12504. See python-uno FAQ.
# since index.LevelFormat.replaceByIndex(2,level_format) does not work
level_format = uno.Any('[][]com.sun.star.beans.PropertyValue', level_format)
uno.invoke(index.LevelFormat, 'replaceByIndex', (2, level_format))
"""
index_types = {
'alpha': 'com.sun.star.text.DocumentIndex',
'toc': 'com.sun.star.text.ContentIndex',
'user': 'com.sun.star.text.UserIndex',
}
index = self.document.createInstance(index_types[index_type])
index.Name = index_name or index_type
index.Title = index_title
if anchor is None:
anchor = self.cursor
anchor.Text.insertTextContent(anchor, index, False)
return index
开发者ID:ddbc,项目名称:Software,代码行数:48,代码来源:sw_uno.py
示例15: attachEventCall
def attachEventCall(self, xComponent, EventName, EventType, EventURL):
try:
oEventProperties = list(range(2))
oEventProperties[0] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue')
oEventProperties[0].Name = "EventType"
oEventProperties[0].Value = EventType
# "Service", "StarBasic"
oEventProperties[1] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue')
oEventProperties[1].Name = "Script" #"URL";
oEventProperties[1].Value = EventURL
uno.invoke(xComponent.Events, "replaceByName",
(EventName, uno.Any("[]com.sun.star.beans.PropertyValue",
tuple(oEventProperties))))
except Exception:
traceback.print_exc()
开发者ID:rohanKanojia,项目名称:core,代码行数:17,代码来源:OfficeDocument.py
示例16: setToUI
def setToUI(self, value):
if (isinstance(value, list)):
value = tuple(value)
elif self.isShort:
value = uno.Any("[]short", (value,))
if value:
if(hasattr(self.unoModel, self.unoPropName)):
if self.unoPropName == "Date":
d = datetime.strptime(value, '%d/%m/%y')
value = Date(d.day, d.month, d.year)
elif self.unoPropName == "Time":
t = datetime.strptime(value, '%H:%M')
value = Time(0, 0, t.minute, t.hour, False)
setattr(self.unoModel, self.unoPropName, value)
else:
uno.invoke(self.unoModel, "set" + self.unoPropName, (value,))
开发者ID:RaghavBhardwaj,项目名称:eisenvault_updated_source,代码行数:17,代码来源:UnoDataAware.py
示例17: linkSectiontoTemplate
def linkSectiontoTemplate(
self, TemplateName, SectionName, oTextSection=None):
try:
if not oTextSection:
oTextSection = self.xTextDocument.TextSections.getByName(
SectionName)
oSectionLink = \
uno.createUnoStruct('com.sun.star.text.SectionFileLink')
oSectionLink.FileURL = TemplateName
uno.invoke(oTextSection, "setPropertyValues",
(("FileLink", "LinkRegion"), (oSectionLink, SectionName)))
NewSectionName = oTextSection.Name
if NewSectionName is not SectionName:
oTextSection.Name = SectionName
except Exception:
traceback.print_exc()
开发者ID:LibreOffice,项目名称:core,代码行数:17,代码来源:TextSectionHandler.py
示例18: addMenuItem
def addMenuItem( self, documenttype, menu, title, command, submenu = False, inside = True ):
aUIMgr = self.ctx.ServiceManager.createInstanceWithContext( 'com.sun.star.ui.ModuleUIConfigurationManagerSupplier', self.ctx )
xUIMgr = aUIMgr.getUIConfigurationManager( documenttype )
settings = xUIMgr.getSettings( 'private:resource/menubar/menubar', True )
def findCommand( items, command ):
for i in range( items.getCount() ):
menu = unprops( items.getByIndex( i ) )
if 'CommandURL' in menu and menu.CommandURL == command:
if inside and 'ItemDescriptorContainer' in menu and menu.ItemDescriptorContainer:
return menu.ItemDescriptorContainer, 0
else:
return items, i + 1
if 'ItemDescriptorContainer' in menu and menu.ItemDescriptorContainer:
container, index = findCommand( menu.ItemDescriptorContainer, command )
if container is not None:
return container, index
return None, None
newmenu = EasyDict()
if submenu:
newmenu.CommandURL = command
newmenu.ItemDescriptorContainer = xUIMgr.createSettings()
elif ':' not in command:
newmenu.CommandURL = self.commandURL( command )
else:
newmenu.CommandURL = command
newmenu.Label = title
newmenu.Type = 0
container, index = findCommand( settings, newmenu.CommandURL )
if index == 0:
# assume this submenu was created by us and ignore it
return
while container is not None:
uno.invoke( container, 'removeByIndex', (index-1,) )
container, index = findCommand( settings, newmenu.CommandURL )
container, index = findCommand( settings, menu )
assert container is not None, '%s not found in %s'%(menu, documenttype)
# we need uno.invoke() to pass PropertyValue array as Any
uno.invoke( container, 'insertByIndex', (index, anyprops( newmenu )) )
xUIMgr.replaceSettings( 'private:resource/menubar/menubar', settings)
xUIMgr.store()
开发者ID:KAMI911,项目名称:loec,代码行数:45,代码来源:extensioncore.py
示例19: __init__
def __init__(self, xmsf, width, taskName, displayCount, resources, hid):
super(StatusDialog, self).__init__(xmsf)
self.res = resources
if not (len(self.res) == 6):
# display a close button?
raise IllegalArgumentException("The resources argument should contain 6 Strings, see doc on constructor.")
b = not (self.enableBreak or self.closeOnFinish)
uno.invoke(self.xDialogModel, "setPropertyValues", (
("Closeable",
PropertyNames.PROPERTY_HEIGHT,
PropertyNames.PROPERTY_HELPURL, "Moveable",
PropertyNames.PROPERTY_NAME,
PropertyNames.PROPERTY_POSITION_X,
PropertyNames.PROPERTY_POSITION_Y,
PropertyNames.PROPERTY_STEP, "Title",
PropertyNames.PROPERTY_WIDTH),
(False, 6 + 25 + (27 if b else 7), hid, True, "StatusDialog", 102, 52, 0,
self.res[0], width)))
tabstop = 1
self.lblTaskName = self.insertLabel("lblTask",
(PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH),
(8, taskName, 6, 6, tabstop, int(width * 2 / 3)))
tabstop += 1
self.lblCounter = self.insertLabel("lblCounter",
(PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH),
(8, "", int(width * 2 / 3), 6, tabstop, int(width / 3) - 4))
tabstop += 1
self.progressBar = self.insertProgressBar("progress",
(PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH),
(10, 6, 16, tabstop, width - 12))
tabstop += 1
if b:
self.btnCancel = self.insertButton("btnCancel", "performCancel", self,
(PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH),
(14, self.res[1], width / 2 - 20, 6 + 25 + 7, tabstop, 40))
tabstop += 1
开发者ID:RaghavBhardwaj,项目名称:eisenvault_updated_source,代码行数:42,代码来源:StatusDialog.py
示例20: updateUI
def updateUI(self):
try:
data = getattr(self._dataObject, self._field)
except Exception:
data = uno.invoke(self._dataObject, "get" + self._field, ())
ui = self.getFromUI()
if data is not ui:
try:
self.setToUI(data)
except Exception:
traceback.print_exc()
开发者ID:chrissherlock,项目名称:libreoffice-experimental,代码行数:11,代码来源:DataAware.py
注:本文中的uno.invoke函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论