added About dialog, with Tabellio logo
This commit is contained in:
parent
1cfc154656
commit
ff434b8a60
|
@ -0,0 +1,10 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<oor:component-schema
|
||||
oor:name="FileLocations"
|
||||
oor:package="org.entrouvert.openoffice.tabellio"
|
||||
xmlns:oor="http://openoffice.org/2001/registry">
|
||||
<templates/>
|
||||
<component>
|
||||
<prop oor:name="ImageLogo" oor:type="xs:string"/>
|
||||
</component>
|
||||
</oor:component-schema>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<oor:component-data
|
||||
oor:name="FileLocations"
|
||||
oor:package="org.entrouvert.openoffice.tabellio"
|
||||
xmlns:oor="http://openoffice.org/2001/registry">
|
||||
<prop oor:name="ImageLogo">
|
||||
<value>%origin%/images/tabellio.jpeg</value>
|
||||
</prop>
|
||||
</oor:component-data>
|
|
@ -8,4 +8,8 @@
|
|||
manifest:media-type="application/vnd.sun.star.configuration-data"/>
|
||||
<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
|
||||
manifest:full-path="Office/UI/WriterWindowState.xcu"/>
|
||||
<manifest:file-entry manifest:full-path="FileLocations.xcs"
|
||||
manifest:media-type="application/vnd.sun.star.configuration-schema"/>
|
||||
<manifest:file-entry manifest:full-path="FileLocations.xcu"
|
||||
manifest:media-type="application/vnd.sun.star.configuration-data"/>
|
||||
</manifest:manifest>
|
||||
|
|
|
@ -23,6 +23,7 @@ from com.sun.star.beans import PropertyValue
|
|||
|
||||
from com.sun.star.awt import Rectangle
|
||||
from com.sun.star.awt import WindowDescriptor
|
||||
from com.sun.star.awt import FontDescriptor
|
||||
|
||||
from com.sun.star.awt.WindowClass import MODALTOP
|
||||
from com.sun.star.awt.VclWindowPeerAttribute import OK, OK_CANCEL, YES_NO, YES_NO_CANCEL, RETRY_CANCEL, DEF_OK, DEF_CANCEL, DEF_RETRY, DEF_YES, DEF_NO
|
||||
|
@ -74,6 +75,14 @@ def getText(nodeT):
|
|||
return rc
|
||||
|
||||
|
||||
class CloseListener(unohelper.Base, XActionListener):
|
||||
def __init__(self, dialog):
|
||||
self.dialog = dialog
|
||||
|
||||
def actionPerformed(self, actionEvent):
|
||||
self.dialog.endExecute()
|
||||
|
||||
|
||||
class MyActionListener( unohelper.Base, XActionListener ):
|
||||
def __init__(self, doc, combobox, dialog ):
|
||||
self.nCount = 0
|
||||
|
@ -560,6 +569,88 @@ class ShowHideToolbars(unohelper.Base, XJobExecutor):
|
|||
print str(e)
|
||||
|
||||
|
||||
class AboutDialog(unohelper.Base, XJobExecutor):
|
||||
def __init__(self, ctx):
|
||||
self.ctx = ctx
|
||||
|
||||
def getLogoUrl(self):
|
||||
oConfigAccess = getConfigAccess(self.ctx,
|
||||
'/org.entrouvert.openoffice.tabellio.FileLocations', False)
|
||||
exp = self.ctx.getValueByName('/singletons/com.sun.star.util.theMacroExpander')
|
||||
path = oConfigAccess.getByName('ImageLogo')
|
||||
url = exp.expandMacros(path)
|
||||
return url
|
||||
|
||||
|
||||
def trigger(self, args):
|
||||
ctx = self.ctx
|
||||
try:
|
||||
smgr = self.ctx.ServiceManager
|
||||
dialogModel = smgr.createInstanceWithContext(
|
||||
'com.sun.star.awt.UnoControlDialogModel', self.ctx)
|
||||
dialogModel.Width = 210
|
||||
dialogModel.Height = 100
|
||||
dialogModel.Title = u'À propos de Tabellio'
|
||||
|
||||
logo = dialogModel.createInstance('com.sun.star.awt.UnoControlImageControlModel')
|
||||
logo.PositionX = 5
|
||||
logo.PositionY = 5
|
||||
logo.Width = 155/2
|
||||
logo.Height = 155/2
|
||||
logo.ImageURL = self.getLogoUrl()
|
||||
dialogModel.insertByName('logo', logo)
|
||||
|
||||
text = dialogModel.createInstance('com.sun.star.awt.UnoControlFixedTextModel')
|
||||
text.PositionX = 5 + 155/2 + 5
|
||||
text.PositionY = 5
|
||||
text.Width = 100
|
||||
text.Height = 25
|
||||
text.Label = u'Tabellio³'
|
||||
fdesc = FontDescriptor()
|
||||
fdesc.Weight = 200
|
||||
fdesc.Height = 16
|
||||
text.FontDescriptor = fdesc
|
||||
dialogModel.insertByName('title', text)
|
||||
|
||||
|
||||
# close button
|
||||
buttonModel = dialogModel.createInstance(
|
||||
"com.sun.star.awt.UnoControlButtonModel" )
|
||||
buttonModel.PositionX = 155
|
||||
buttonModel.PositionY = 80
|
||||
buttonModel.Width = 50
|
||||
buttonModel.Height = 14
|
||||
buttonModel.Name = 'CloseButton'
|
||||
buttonModel.TabIndex = 0
|
||||
buttonModel.Label = u'Fermer'
|
||||
dialogModel.insertByName('closeButton', buttonModel)
|
||||
|
||||
# create the dialog control and set the model
|
||||
controlContainer = smgr.createInstanceWithContext(
|
||||
"com.sun.star.awt.UnoControlDialog", self.ctx)
|
||||
controlContainer.setModel(dialogModel)
|
||||
|
||||
controlContainer.getControl('closeButton').addActionListener(
|
||||
CloseListener(controlContainer))
|
||||
|
||||
# create a peer
|
||||
toolkit = smgr.createInstanceWithContext(
|
||||
'com.sun.star.awt.ExtToolkit', ctx);
|
||||
|
||||
controlContainer.setVisible(False);
|
||||
controlContainer.createPeer(toolkit, None);
|
||||
|
||||
# execute it
|
||||
controlContainer.execute()
|
||||
|
||||
# dispose the dialog
|
||||
controlContainer.dispose()
|
||||
|
||||
except Exception,e:
|
||||
print str(e)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
g_ImplementationHelper = unohelper.ImplementationHelper()
|
||||
|
@ -594,3 +685,8 @@ g_ImplementationHelper.addImplementation(
|
|||
"org.entrouvert.openoffice.ShowHideToolbars",
|
||||
("com.sun.star.task.Job",))
|
||||
|
||||
g_ImplementationHelper.addImplementation(
|
||||
AboutDialog,
|
||||
"org.entrouvert.openoffice.AboutDialog",
|
||||
("com.sun.star.task.Job",))
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 7.6 KiB |
Reference in New Issue