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