Compare commits
2 Commits
70654bf40f
...
3313dddae2
Author | SHA1 | Date |
---|---|---|
Mauricio | 3313dddae2 | |
Mauricio | cbf560abef |
|
@ -11,7 +11,6 @@ from .easydrawpage import LOGalleries
|
||||||
def __getattr__(name):
|
def __getattr__(name):
|
||||||
classes = {
|
classes = {
|
||||||
'active': LODocuments().active,
|
'active': LODocuments().active,
|
||||||
'active_sheet': LODocuments().active.active,
|
|
||||||
'clipboard': ClipBoard,
|
'clipboard': ClipBoard,
|
||||||
'cmd': LOMain.commands,
|
'cmd': LOMain.commands,
|
||||||
'color': Color(),
|
'color': Color(),
|
||||||
|
@ -30,7 +29,6 @@ def __getattr__(name):
|
||||||
'menus': LOMenus(),
|
'menus': LOMenus(),
|
||||||
'paths': Paths,
|
'paths': Paths,
|
||||||
'url': URL,
|
'url': URL,
|
||||||
'selection': LODocuments().active.selection,
|
|
||||||
'set_config': set_app_config,
|
'set_config': set_app_config,
|
||||||
'shell': Shell,
|
'shell': Shell,
|
||||||
'shortcuts': LOShortCuts(),
|
'shortcuts': LOShortCuts(),
|
||||||
|
|
|
@ -26,6 +26,7 @@ MODELS = {
|
||||||
'button': 'com.sun.star.awt.UnoControlButtonModel',
|
'button': 'com.sun.star.awt.UnoControlButtonModel',
|
||||||
'link': 'com.sun.star.awt.UnoControlFixedHyperlinkModel',
|
'link': 'com.sun.star.awt.UnoControlFixedHyperlinkModel',
|
||||||
'image': 'com.sun.star.awt.UnoControlImageControlModel',
|
'image': 'com.sun.star.awt.UnoControlImageControlModel',
|
||||||
|
'pattern': 'com.sun.star.awt.UnoControlPatternFieldModel',
|
||||||
# ~ ToDo
|
# ~ ToDo
|
||||||
'radio': 'com.sun.star.awt.UnoControlRadioButtonModel',
|
'radio': 'com.sun.star.awt.UnoControlRadioButtonModel',
|
||||||
'checkbox': 'com.sun.star.awt.UnoControlCheckBoxModel',
|
'checkbox': 'com.sun.star.awt.UnoControlCheckBoxModel',
|
||||||
|
@ -481,12 +482,51 @@ class UnoImage(UnoBaseObject):
|
||||||
self.model.Graphic = value._get_graphic()
|
self.model.Graphic = value._get_graphic()
|
||||||
|
|
||||||
|
|
||||||
|
class UnoPattern(UnoBaseObject):
|
||||||
|
|
||||||
|
def __init__(self, obj):
|
||||||
|
super().__init__(obj)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def type(self):
|
||||||
|
return 'pattern'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def value(self):
|
||||||
|
return self.model.Text
|
||||||
|
@value.setter
|
||||||
|
def value(self, value):
|
||||||
|
self.model.Text = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def edit_mask(self):
|
||||||
|
return self.model.EditMask
|
||||||
|
@edit_mask.setter
|
||||||
|
def edit_mask(self, value):
|
||||||
|
self.model.EditMask = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def literal_mask(self):
|
||||||
|
return self.model.LiteralMask
|
||||||
|
@literal_mask.setter
|
||||||
|
def literal_mask(self, value):
|
||||||
|
self.model.LiteralMask = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def strict_format(self):
|
||||||
|
return self.model.StrictFormat
|
||||||
|
@strict_format.setter
|
||||||
|
def strict_format(self, value):
|
||||||
|
self.model.StrictFormat = value
|
||||||
|
|
||||||
|
|
||||||
UNO_CLASSES = {
|
UNO_CLASSES = {
|
||||||
'label': UnoLabel,
|
'label': UnoLabel,
|
||||||
'button': UnoButton,
|
'button': UnoButton,
|
||||||
'text': UnoText,
|
'text': UnoText,
|
||||||
'link': UnoLabelLink,
|
'link': UnoLabelLink,
|
||||||
'image': UnoImage,
|
'image': UnoImage,
|
||||||
|
'pattern': UnoPattern,
|
||||||
# ~ 'radio': UnoRadio,
|
# ~ 'radio': UnoRadio,
|
||||||
# ~ 'checkbox': UnoCheckBox,
|
# ~ 'checkbox': UnoCheckBox,
|
||||||
# ~ 'listbox': UnoListBox,
|
# ~ 'listbox': UnoListBox,
|
||||||
|
|
|
@ -11,6 +11,10 @@ from .easybase import LOBase
|
||||||
from .easyide import LOBasicIDE
|
from .easyide import LOBasicIDE
|
||||||
|
|
||||||
|
|
||||||
|
DESKTOP = create_instance('com.sun.star.frame.Desktop', True)
|
||||||
|
ACTIVE = DESKTOP.getCurrentComponent()
|
||||||
|
|
||||||
|
|
||||||
class LODocuments():
|
class LODocuments():
|
||||||
"""Class for documents
|
"""Class for documents
|
||||||
"""
|
"""
|
||||||
|
@ -37,7 +41,7 @@ class LODocuments():
|
||||||
# ~ BASE: 'com.sun.star.sdb.DocumentDataSource',
|
# ~ BASE: 'com.sun.star.sdb.DocumentDataSource',
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._desktop = create_instance('com.sun.star.frame.Desktop', True)
|
self._desktop = DESKTOP
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
# ~ len(self._desktop.Components)
|
# ~ len(self._desktop.Components)
|
||||||
|
@ -82,14 +86,16 @@ class LODocuments():
|
||||||
return self._classes[main](doc)
|
return self._classes[main](doc)
|
||||||
|
|
||||||
mm = create_instance('com.sun.star.frame.ModuleManager')
|
mm = create_instance('com.sun.star.frame.ModuleManager')
|
||||||
|
# ~ ??
|
||||||
|
print(mm.supportsService('com.sun.star.frame.ModuleManager'))
|
||||||
|
|
||||||
type_module = mm.identify(doc)
|
type_module = mm.identify(doc)
|
||||||
return self._classes[type_module](doc)
|
return self._classes[type_module](doc)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def active(self):
|
def active(self):
|
||||||
"""Get active doc"""
|
"""Get active doc"""
|
||||||
doc = self._desktop.getCurrentComponent()
|
obj = self._get_class_doc(ACTIVE)
|
||||||
obj = self._get_class_doc(doc)
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
def new(self, type_doc: str='calc', args: dict={}):
|
def new(self, type_doc: str='calc', args: dict={}):
|
||||||
|
|
|
@ -486,6 +486,7 @@ class LOMain():
|
||||||
"""Class for disable and enable commands
|
"""Class for disable and enable commands
|
||||||
|
|
||||||
`See DispatchCommands <https://wiki.documentfoundation.org/Development/DispatchCommands>`_
|
`See DispatchCommands <https://wiki.documentfoundation.org/Development/DispatchCommands>`_
|
||||||
|
https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1configuration_1_1ConfigurationProvider.html
|
||||||
"""
|
"""
|
||||||
@classmethod
|
@classmethod
|
||||||
def _set_app_command(cls, command: str, disable: bool) -> bool:
|
def _set_app_command(cls, command: str, disable: bool) -> bool:
|
||||||
|
@ -500,6 +501,7 @@ class LOMain():
|
||||||
"""
|
"""
|
||||||
NEW_NODE_NAME = f'zaz_disable_command_{command.lower()}'
|
NEW_NODE_NAME = f'zaz_disable_command_{command.lower()}'
|
||||||
name = 'com.sun.star.configuration.ConfigurationProvider'
|
name = 'com.sun.star.configuration.ConfigurationProvider'
|
||||||
|
# ~ name = 'com.sun.star.configuration.theDefaultProvider'
|
||||||
service = 'com.sun.star.configuration.ConfigurationUpdateAccess'
|
service = 'com.sun.star.configuration.ConfigurationUpdateAccess'
|
||||||
node_name = '/org.openoffice.Office.Commands/Execute/Disabled'
|
node_name = '/org.openoffice.Office.Commands/Execute/Disabled'
|
||||||
|
|
||||||
|
@ -507,9 +509,6 @@ class LOMain():
|
||||||
node = PropertyValue(Name='nodepath', Value=node_name)
|
node = PropertyValue(Name='nodepath', Value=node_name)
|
||||||
update = cp.createInstanceWithArguments(service, (node,))
|
update = cp.createInstanceWithArguments(service, (node,))
|
||||||
|
|
||||||
m = create_instance('mytools.Mri')
|
|
||||||
m.inspect(update)
|
|
||||||
|
|
||||||
result = True
|
result = True
|
||||||
try:
|
try:
|
||||||
if disable:
|
if disable:
|
||||||
|
|
|
@ -217,6 +217,16 @@ class LOShape(BaseObject):
|
||||||
mime_type = self.MIME_TYPE.get(mt, mt)
|
mime_type = self.MIME_TYPE.get(mt, mt)
|
||||||
return mime_type
|
return mime_type
|
||||||
|
|
||||||
|
@property
|
||||||
|
def path(self):
|
||||||
|
return self.url
|
||||||
|
@property
|
||||||
|
def url(self):
|
||||||
|
url = ''
|
||||||
|
if self.is_image:
|
||||||
|
url = Paths.to_system(self.obj.GraphicURL.OriginURL)
|
||||||
|
return url
|
||||||
|
|
||||||
# ~ not work
|
# ~ not work
|
||||||
@property
|
@property
|
||||||
def visible(self):
|
def visible(self):
|
||||||
|
|
Loading…
Reference in New Issue