diff --git a/doc/build/.doctrees/environment.pickle b/doc/build/.doctrees/environment.pickle index 6d11d87..537bb3f 100644 Binary files a/doc/build/.doctrees/environment.pickle and b/doc/build/.doctrees/environment.pickle differ diff --git a/doc/build/.doctrees/main/application.doctree b/doc/build/.doctrees/main/application.doctree index 9a8bd8b..d883684 100644 Binary files a/doc/build/.doctrees/main/application.doctree and b/doc/build/.doctrees/main/application.doctree differ diff --git a/doc/build/_sources/main/application.rst.txt b/doc/build/_sources/main/application.rst.txt index 859062b..0f45df2 100644 --- a/doc/build/_sources/main/application.rst.txt +++ b/doc/build/_sources/main/application.rst.txt @@ -231,8 +231,20 @@ Export filter_name = 'doc' doc.export(path, filter_name) + path = '/home/mau/myfile.rtf' + filter_name = 'rtf' + doc.export(path, filter_name) + * For all support formats look `Apendix`_ +* Export in memory. + +.. code-block:: python + + doc = app.docs.new() + filter_name = 'xlsx' + excel_doc = doc.export(filter_name=filter_name) + Fonst ^^^^^ @@ -294,12 +306,14 @@ title doc = app.active app.msgbox(doc.title) + doc.title = 'New title' + app.msgbox(doc.title) type ~~~~ -* Get type document: calc, writer, etc. +* Get type document: calc, writer, etc. (read only) .. code-block:: python @@ -310,7 +324,7 @@ type uid ~~~ -* Get internal RuntimeUID form document. +* Get internal RuntimeUID form document. (read only) .. code-block:: python @@ -321,7 +335,7 @@ uid is_saved ~~~~~~~~ -* If document is saved in this or not +* If document is saved in this or not (read only) .. code-block:: python @@ -332,7 +346,7 @@ is_saved is_modified ~~~~~~~~~~~ -* If document has been modified +* If document has been modified (read only) .. code-block:: python @@ -352,7 +366,7 @@ is_read_only path ~~~~ -* Get path of document. +* Get path of document. (read only) .. code-block:: python @@ -361,9 +375,9 @@ path dir -~~~~ +~~~ -* Get only directory from path saved +* Get only directory from path saved (read only) .. code-block:: python @@ -371,7 +385,124 @@ dir app.msgbox(doc.dir) +file_name +~~~~~~~~~ +* Get only file name from path saved (read only) + +.. code-block:: python + + doc = app.active + app.msgbox(doc.file_name) + + +name +~~~~ + +* Get only name without extension (read only) + +.. code-block:: python + + doc = app.active + app.msgbox(doc.file_name) + + +visible +~~~~~~~ + +* Hide or show document. + +.. code-block:: python + + doc = app.active + doc.visible = False + app.msgbox(doc.visible) + doc.visible = True + + +zoom +~~~~ + +* Get or set zoom value. + +.. code-block:: python + + doc = app.active + zoom = doc.zoom + app.msgbox(zoom) + doc.zoom = zoom * 2 + app.msgbox(doc.zoom) + doc.zoom = zoom + + +selection +~~~~~~~~~ + +* **CAUTION**: Selection can be many things. + +.. code-block:: python + + doc = app.active + selection = doc.selection + app.msgbox(selection) + + +status_bar +~~~~~~~~~~ + +* Get status bar, always control in other thread. + +.. code-block:: python + + @app.run_in_thread + def update_status_bar(sb, text, limit): + sb.start(text, limit) + for i in range(limit): + sb.setValue(i) + app.sleep(1) + # ~ Is important free status bar + sb.end() + return + + def main(): + doc = app.active + update_status_bar(doc.status_bar, 'Line', 10) + return + + +Methods +^^^^^^^ + +set_focus +~~~~~~~~~ + +.. code-block:: python + + name = 'MyDoc.ods' + if name in app.docs: + doc = app.docs[name] + doc.set_focus() + +copy +~~~~ + +* Copy current selection + +.. code-block:: python + + doc = app.active + doc.copy() + + +paste +~~~~~ + +* Paste any content in clipboard + +.. code-block:: python + + doc = app.active + doc.paste() .. _dispatch command: https://wiki.documentfoundation.org/Development/DispatchCommands diff --git a/doc/build/main/application.html b/doc/build/main/application.html index e1f12f7..9ca924d 100644 --- a/doc/build/main/application.html +++ b/doc/build/main/application.html @@ -220,11 +220,21 @@ path = '/home/mau/myfile.doc' filter_name = 'doc' doc.export(path, filter_name) + +path = '/home/mau/myfile.rtf' +filter_name = 'rtf' +doc.export(path, filter_name) +
doc = app.docs.new()
+filter_name = 'xlsx'
+excel_doc = doc.export(filter_name=filter_name)
+
+

Fonst

@@ -276,13 +286,15 @@

title

doc = app.active
 app.msgbox(doc.title)
+doc.title = 'New title'
+app.msgbox(doc.title)
 

type

doc = app.active
 app.msgbox(doc.type)
@@ -292,7 +304,7 @@
 

uid

    -
  • Get internal RuntimeUID form document.

  • +
  • Get internal RuntimeUID form document. (read only)

doc = app.active
 app.msgbox(doc.uid)
@@ -302,7 +314,7 @@
 

is_saved

    -
  • If document is saved in this or not

  • +
  • If document is saved in this or not (read only)

doc = app.active
 app.msgbox(doc.is_saved)
@@ -312,7 +324,7 @@
 

is_modified

    -
  • If document has been modified

  • +
  • If document has been modified (read only)

doc = app.active
 app.msgbox(doc.is_modified)
@@ -329,7 +341,7 @@
 

path

    -
  • Get path of document.

  • +
  • Get path of document. (read only)

doc = app.active
 app.msgbox(doc.path)
@@ -339,13 +351,124 @@
 

dir

    -
  • Get only directory from path saved

  • +
  • Get only directory from path saved (read only)

doc = app.active
 app.msgbox(doc.dir)
 
+
+

file_name

+
    +
  • Get only file name from path saved (read only)

  • +
+
doc = app.active
+app.msgbox(doc.file_name)
+
+
+
+
+

name

+
    +
  • Get only name without extension (read only)

  • +
+
doc = app.active
+app.msgbox(doc.file_name)
+
+
+
+
+

visible

+
    +
  • Hide or show document.

  • +
+
doc = app.active
+doc.visible = False
+app.msgbox(doc.visible)
+doc.visible = True
+
+
+
+
+

zoom

+
    +
  • Get or set zoom value.

  • +
+
doc = app.active
+zoom = doc.zoom
+app.msgbox(zoom)
+doc.zoom = zoom * 2
+app.msgbox(doc.zoom)
+doc.zoom = zoom
+
+
+
+
+

selection

+
    +
  • CAUTION: Selection can be many things.

  • +
+
doc = app.active
+selection = doc.selection
+app.msgbox(selection)
+
+
+
+
+

status_bar

+
    +
  • Get status bar, always control in other thread.

  • +
+
@app.run_in_thread
+def update_status_bar(sb, text, limit):
+    sb.start(text, limit)
+    for i in range(limit):
+        sb.setValue(i)
+        app.sleep(1)
+    # ~ Is important free status bar
+    sb.end()
+    return
+
+def main():
+    doc = app.active
+    update_status_bar(doc.status_bar, 'Line', 10)
+    return
+
+
+
+
+
+

Methods

+
+

set_focus

+
name = 'MyDoc.ods'
+if name in app.docs:
+    doc = app.docs[name]
+    doc.set_focus()
+
+
+
+
+

copy

+
    +
  • Copy current selection

  • +
+
doc = app.active
+doc.copy()
+
+
+
+
+

paste

+
    +
  • Paste any content in clipboard

  • +
+
doc = app.active
+doc.paste()
+
+
+
diff --git a/doc/build/main/easymacro.html b/doc/build/main/easymacro.html index 7abfe16..cdbcad4 100644 --- a/doc/build/main/easymacro.html +++ b/doc/build/main/easymacro.html @@ -136,6 +136,7 @@
  • Filters
  • Call dispatch
  • Properties
  • +
  • Methods
  • Calc
      diff --git a/doc/build/searchindex.js b/doc/build/searchindex.js index ff09068..5b567af 100644 --- a/doc/build/searchindex.js +++ b/doc/build/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["index","main/apendixes","main/application","main/base","main/calc","main/config","main/easymacro","main/email","main/examples","main/examples_app","main/examples_base","main/examples_calc","main/examples_draw","main/examples_writer","main/intro","main/paths","main/tools","main/tools_for_debug","main/writer"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,sphinx:56},filenames:["index.rst","main/apendixes.rst","main/application.rst","main/base.rst","main/calc.rst","main/config.rst","main/easymacro.rst","main/email.rst","main/examples.rst","main/examples_app.rst","main/examples_base.rst","main/examples_calc.rst","main/examples_draw.rst","main/examples_writer.rst","main/intro.rst","main/paths.rst","main/tools.rst","main/tools_for_debug.rst","main/writer.rst"],objects:{},objnames:{},objtypes:{},terms:{"0":[1,5,9,13,14,15,17],"008080":16,"02":14,"04":14,"06":[7,15,16],"07":14,"080315":16,"082211":16,"09":16,"0k":16,"1":[5,10,14,15,16,17],"10":16,"100":11,"1090":1,"11":[14,16],"12":16,"125":16,"126446":16,"128487":16,"13":[7,16],"14":16,"15":16,"16":16,"17":16,"18":16,"19":16,"2":[5,10,15,16,17],"20":[14,16],"200":[11,16],"2001":10,"2002":10,"2003":10,"2004":10,"2005":10,"2021":[7,14,15,16],"21":[15,16],"22":16,"23":[7,14,16],"24":[7,15],"26":[7,16],"27":16,"29":15,"3":[5,10,14,15],"30":7,"300":11,"34":16,"35":16,"3m":16,"4":[10,15,16],"40":14,"400":11,"41":14,"42":16,"43":[7,16],"46":16,"47":[15,16],"48":16,"495":7,"5":[10,16],"50":14,"500":[11,17],"53":[14,16],"6":16,"7":14,"7iznrbyw":7,"8859":15,"9":5,"abstract":6,"case":16,"catch":6,"class":10,"default":[2,7,15,16],"do":15,"export":6,"extensi\u00f3n":5,"final":[1,14],"function":[14,17],"import":[1,2,3,4,6,7,10,15,16,17,18],"new":[1,5,6,10,12,14],"null":10,"opci\u00f3n":5,"public":5,"return":[9,10,11,12,13,16,17],"super":16,"true":[1,2,5,7,10,12,15,16],"while":2,A:5,And:17,FOR:5,For:[0,2,5,8,15,16],If:[5,6,7,17],In:[5,14,16],Is:[5,16],It:[5,6],Of:16,Ons:5,Or:15,The:5,To:6,With:[2,14],a1:[1,11],a2:1,absolut:5,academ:13,act:15,action:[15,16],activ:[2,6,13,17,18],active_sheet:[4,11],add:[5,14,15,17],addin:[5,14],addonmenu:5,address:7,all:[0,2,5,7,15],along:5,alt:[5,9],alwai:[1,2,3,4,6,7,15,16,17,18],an:[6,15],ani:[2,5,6,7,16,17],apendix:[0,2],api:[6,15,16],app:[1,2,3,4,6,7,9,10,11,12,13,15,16,17,18],app_nam:[15,16],applic:[0,5,6,8,16],april:11,apt:14,ar:[6,7,15,16],arbitrari:2,archlinux:14,arg:[2,16],argument:[2,5],ask:15,attach:7,automat:[5,11,17],autostyl:8,awt:2,b:[1,15],base:[0,5,6,8],base_insert_data:10,base_select_data:10,basedatefield:10,basemodel:10,basic:[14,16],bcc:7,been:2,befor:[5,17],bergman:[7,10,16],best:16,better:[16,17],between:6,bin:[5,15],binari:6,blank:5,bmp:5,bodi:7,bool:5,born:10,both:16,box:6,build:15,bytesequ:1,c:14,cach:15,calc:[0,2,5,6,8,9,14,15],calc_data_to_cel:11,calcul:[11,16],call:6,call_dispatch:2,call_macro:16,can:[2,5,6,7,10,14,15,16,17],captur:16,catch_except:17,caution:[15,16],cc:7,cd:[5,14],cell:8,chang:15,charfield:10,client:7,clipboard:8,clock:16,clone:14,close:[6,7,12],code:[5,6,17],color:6,color_html:16,color_nam:16,color_rgb:16,com:[1,2,7],command:[2,16],commandurl:9,common:2,complex:[6,16],compon:[5,14],compress:14,con:6,conf:[5,7,16],config:[7,15,16],configur:[0,6,7],confirm:15,connect:[3,7,10],contact:[10,16],contacto:10,contain:6,content:15,context:[2,5,15],copi:[5,6,14,17],correctli:5,correo:7,cotillar:10,count:6,cours:[14,16],creat:[5,6,8,14],create_inst:2,create_t:10,cryptographi:16,csv:6,ctrl:[5,9],cuat:14,current:[5,6,16],custom:[6,8],danger:16,darkblu:16,darken:15,data:[1,2,6,8,9,16,17],data_to_dict:16,databas:[6,10],database_proxi:10,databaseproxi:10,date:[6,10,17],datetim:10,db:[3,10],de:5,debug:[0,2,6,7,9,15,16],decrypt:6,def:[9,10,11,12,13,16,17],defin:15,delet:[6,8],delete_menu:9,delin:15,descript:5,desktop1:2,desktop2:2,desktop:[2,16],detail:5,dev:14,develop:[5,6,14],dialog:2,dialogprovider2:2,dict:[7,10],dict_to_properti:16,dictionari:[5,6],difficult:17,digest:6,dir:6,dir_tmp:15,directli:[6,16],directori:[2,6,14],dispatch:6,displai:5,display_nam:5,displaynam:5,distribut:5,doc:[1,3,6,10,12,13,15],document:[2,6,12,16],documentservic:1,docx:2,domain:14,don:[14,15],done:14,download:[14,15,16],draw:[0,2,5,8],drwxr:16,ds:2,dt:15,each:5,easi:16,easili:6,easymacro:[0,1,2,3,4,7,10,15,16,17,18],echochar:16,edit:5,either:5,el:5,elmau:[5,14,15],els:10,email:[0,6],en:[1,5,6],enabl:1,encapsul:1,encapsulado:1,encod:15,encrypt:6,encrypt_decrypt:16,end:16,ep:1,epoch:16,eps_encapsulated_postscript:1,epub:7,error:6,errorbox:16,es:[1,5],etc:2,even:5,everi:16,exactli:5,exampl:[0,2,5,9],except:6,execut:[6,10,16],exist:[2,6,10],exists_app:15,exit:15,ext:15,extens:[0,6,17],extensionnam:5,extern:6,extract:15,f:[1,2,5,15],fals:[1,10],februari:11,field:[1,7],file1:7,file2:7,file:[0,2,6,7,14],file_nam:[15,16],file_test:5,fileformatvers:1,filter:[0,6,15],filter_nam:2,filterservic:1,finish:16,first:0,fit:5,flag:1,folder:[5,7,15],fonda:10,fonst:6,font:2,forget:14,form:2,format:[2,5,6,7,16],foundat:5,frame:2,free:5,fresh:14,from:[2,6,7,8,10,14],from_csv:15,from_id:15,from_json:15,galleri:2,gandi:7,gener:[5,14],get:[0,6,10],get_color:16,get_config:16,get_desktop:2,get_dir:15,get_epoch:16,get_fil:15,get_filt:[1,2],get_font:2,get_json:16,get_queri:10,git:14,gnome:16,gnu:[5,16],gran:5,great:5,ha:2,happi:6,have:[5,17],he:15,header:1,hello:[7,16],hi:15,hidden:[2,7,12,16],himself:15,home:[2,3,5,6,7,10,12,16,17],hope:5,html:15,http:[5,14,16],httpx:16,i18n:5,i:[7,14,16],id:[6,10],id_ext:15,id_fold:15,id_par:15,idea:15,identityfield:10,idl:5,idlc:5,imag:[5,8,15],immedi:15,impli:5,impress:[2,5],impress_eps_export:1,includ:5,index:[0,9,15],info:[5,6,9,14],info_debug:[6,9,16],inform:[15,17],ingrid:[7,10,16],init:15,initi:10,inputbox:6,insert:[8,9],insert_menu_in_calc:9,instal:[0,5,6,10,16,17],instanc:[1,6],instruct:15,integ:5,intern:[2,5],introduct:0,invers:5,ipifi:16,is_dir:15,is_fil:15,is_mac:16,is_win:16,iso:15,issu:17,iter:6,jane:10,januari:11,jefferson:15,join:6,json:6,json_dump:16,json_load:16,jun:16,kei:5,keyboard:5,kill:15,kim:10,know:15,label:[5,9],lang:16,languag:[5,16],languaj:16,later:5,layer:6,legacy_table_nam:10,len:2,lessen:15,letmein:[2,16],letter_lov:16,lh:16,lib:5,librari:[0,1,2,3,4,7,9,15,16,18],libre_offic:15,libreoffic:[2,5,6,7,14,16,17],license_:5,license_en:5,light:15,like:5,line:16,link:5,linux:16,list:6,list_of_list:16,local:[7,14],log:6,logo:[5,15],look:[2,5,16],loren:[7,10],love:7,ls:16,lu20665x29msz:15,m:9,mac:16,macro:[5,6,8,9,14],mai:[11,16],mail1:7,mail2:7,mail3:7,mail:7,main:16,major:6,make:[6,8,14],manag:5,mandatori:1,mani:[],march:11,marion:10,mau:[2,3,5,7,10,12,15,16,17],mbox:7,md:15,me:15,measur:16,member:15,memori:2,menu:8,menu_main:5,merchant:5,merg:15,merge_zip:15,messag:[6,7],message1:7,message2:7,meta:10,method:[2,15],mi:5,mine:15,model:10,modifi:[2,5],modul:[0,16],module1:16,month:11,more:[5,6,7,15,16],move:[5,14],mri:6,msg:[2,17],msgbox:[2,3,4,6,9,12,15,16,17,18],multi:5,multipl:15,mx:7,my:[0,5,9,16,17],my_app:16,my_extens:16,mydoc:2,myfil:[2,15],myfirstextens:14,myfirstextension_v0:14,mygreatextens:5,mymacro:9,n:[5,7,14,15],name:[1,4,6,9,10,15,16,17],name_16:5,name_26:5,nbest:7,need:[10,16,17],net:[5,7,14,15],new_nam:15,new_path:2,noexist:7,nombr:5,none:16,normal:[5,16],nosoffic:15,novak:10,now:[14,15,16],nwho:7,obj:[6,17],object:[2,6,17],od:[2,5,15],odb:[3,10],odt:[2,15,16],officemenubar:5,ok:16,one:[5,7,15,17],onli:[2,5,16],open:[5,6,12,17],oper:16,option1:5,option:[5,15],org:[5,16],origin:[2,6],os:[15,16],other:[2,7,15,16],other_nam:[2,15],ott:15,our:[],out:16,output:16,overview:0,oxt:[14,15],p:15,pacman:14,page:[0,5],paramet:0,part:5,particular:5,pass:5,password:[2,7,16],past:12,path:[0,3,6,7,10,12,16],path_dir:15,path_fil:15,path_hom:15,path_new:15,path_pygettext:5,path_python:15,path_sav:7,path_temp:15,path_tmp:15,path_url:15,path_zip:15,pathlib:15,pc:6,pdf:[6,15],peewe:10,pictur:[12,15,16],pip:10,planet:17,pleas:[5,17],png:[5,15,16],popen:16,port:7,possibl:[5,7],postscript:1,pot:[5,14],present:1,presentationdocu:1,previous:2,print:[2,10],privat:16,probabl:6,problem:17,process:17,product:[8,17],program:6,project:[5,14,15,16,17],properti:[5,6],provid:14,prueba:5,publish:5,purpos:5,py:[0,2,5,14],python3:5,python:[6,14,16],pyuno:[2,17],queri:10,question:6,r:[16,17],rang:11,rapid:14,rdb:5,read:[2,6],read_bin:15,receiv:[5,15],recommend:[5,14],recurs:15,redistribut:5,regard:[7,16],regmerg:5,rel:5,rememb:[1,2,3,4,7,15,16,18],remerg:5,remov:9,render:6,replac:6,replace_ext:15,repositori:14,request:16,requir:0,respond:7,result:[2,15,16],row:10,run:16,run_in_thread:16,runtimeuid:2,rw:16,s:[5,6,14],safe_for_delet:15,same:[5,15,16],save:[6,7,8,17],save_bin:15,save_data:16,save_image_from_clipboard:12,save_log:17,save_tmp:15,script:14,sdk:[5,14],search:0,second:16,secret:16,secur:7,see:5,select:[6,8],semant:5,send:[6,16],send_email:7,sent:7,server:7,servic:2,set:[5,8,15],set_config:16,sha256:16,sha512:16,share:5,sheet:[0,6,11],shell:17,shift:[5,9],shortcut:[5,9],should:5,show:[5,6,9,17],show_info_debug:9,show_messag:16,show_tim:16,simpl:6,size:[11,15],sleep:16,soffic:[5,15],sofia:10,softwar:5,sometim:17,sophia:7,sourc:[14,15],space:5,srv:[2,15],ssl:7,standard:16,star:[1,2],start:[5,14,16,17],start_clock:16,start_tim:16,stop:16,stop_clock:16,stop_tim:16,string:[5,6],style:13,stylenam:2,sub:16,subdir:15,subdirectori:15,subject:7,submenu:9,successfulli:14,sudo:14,sun:[1,2],support:[2,14,16],svfilteroptionsdialog:1,svg:15,svtool:1,system:[6,16],t:[5,14,15],t_shift_mod1_mod2:5,tabl:8,taper:15,target:[12,15],technic:16,temp:6,temp_dir:15,templat:16,templatenam:1,tempor:6,teresa:17,term:5,test:[2,10,14,15,16,17],text:[5,6,16],than:7,thi:[2,5,14,15,16,17],thoma:15,thread:[6,7],three:[15,17],thunderbird:7,ticket:17,time:[6,17],timer:6,timer_nam:16,titl:[5,16],tmp:15,tmp_:15,to_csv:15,to_json:15,to_pdf:2,to_system:15,to_url:15,todai:16,token:16,too:[5,7,16],tool:[0,5,6,9],toolbar:5,toolkit:2,total:[11,16],tu:5,tupl:[5,6,10,15],tuple_of_tupl:16,two:[5,15],txt:[15,17],type:[1,3,4,6,16,18],type_extens:5,u:10,ubuntu:14,ui:2,uicompon:1,uinam:[1,2],under:5,uniqu:5,uno:[2,6],uno_packag:15,unopkg:[5,14],unzip:6,urd:5,url:[5,6],url_open:16,us:[1,2,5,6,7,8,14,15,16,17],use_local:5,user:[7,14,15,16],userdata:1,usr:5,utf8:15,v:5,valor:5,valu:5,variant:16,verifi:[6,17],version:16,video:16,vim:5,visibl:2,wai:[7,15],walk:15,walk_dir:15,want:[5,15],warn:6,warranti:5,we:7,web:16,what:5,when:[5,15],where:5,who:15,window:16,without:[2,5,15],wizard:5,work:16,writer:[0,2,5,6,8],writer_table_set_styl:13,www:5,x:16,xl:2,xlsx:2,xml:15,xpathset:15,xr:16,you:[2,5,6,7,10,14,15,16,17],your:[5,6,7,16,17],yournam:5,zaz:[5,9,14,15],zazeasymacro_v0:15,zip:6,zip_cont:15},titles:["Welcome to ZAZ\u2019s documentation!","Apendixes","Application","Base","Calc","Configuration","Library easymacro.py","Email","Examples","For Application","For Base","For Calc","For Draw","For Writer","Introduction","Paths and files","Tools","Tools for debug","Writer"],titleterms:{"catch":17,"default":5,"export":2,"function":5,"new":[2,3],For:[9,10,11,12,13],If:2,To:2,activ:4,all:1,ani:15,apendix:1,applic:[2,9,15],author:5,autostyl:13,base:[3,10],binari:15,box:[16,17],calc:[1,4,11],call:[2,16,17],cell:11,clipboard:12,close:2,color:16,configur:[5,15,16],contain:2,content:[0,6,8],copi:15,count:2,creat:[2,10],csv:15,current:[2,4,18],custom:9,data:[10,11,15],databas:3,date:16,debug:17,decrypt:16,delet:[9,15],dictionari:16,digest:16,dir:[2,15],directori:15,dispatch:2,doc:[2,4,18],document:[0,15],domain:5,draw:12,easymacro:6,email:7,encrypt:16,error:[16,17],exampl:8,except:17,execut:15,exist:15,extens:[5,14,15],extern:16,file:[5,15,17],filter:[1,2],first:14,fonst:2,format:15,from:[12,15,16],get:[1,2,15,16],home:15,icon:5,id:[5,15],imag:12,indic:0,info:[15,16,17],info_debug:17,inform:5,inputbox:16,insert:10,instal:[14,15],instanc:2,introduct:14,is_modifi:2,is_read_onli:2,is_sav:2,iter:2,join:15,json:[15,16],librari:6,libreoffic:15,licens:5,list:16,local:5,log:17,macro:16,main:5,make:[9,16],menu:[5,9],messag:[16,17],mri:17,my:14,name:[2,5],obj:2,open:[2,15,16],overview:14,paramet:5,parent:5,path:[2,5,15],pc:16,pdf:2,program:[5,16],properti:[2,16],py:6,pygettext:5,python:15,question:16,read:15,render:16,replac:15,requir:14,s:0,save:[2,12,15,16],select:[10,15],send:7,set:13,sheet:[1,4],show:16,simpl:16,string:16,system:15,tabl:[0,10,13],temp:15,tempor:15,test:5,text:15,thread:16,time:16,timer:16,titl:2,tool:[16,17],tupl:16,type:[2,5,15],uid:2,unzip:15,url:[15,16],verifi:15,version:5,warn:16,welcom:0,writer:[13,18],zaz:0,zip:15}}) \ No newline at end of file +Search.setIndex({docnames:["index","main/apendixes","main/application","main/base","main/calc","main/config","main/easymacro","main/email","main/examples","main/examples_app","main/examples_base","main/examples_calc","main/examples_draw","main/examples_writer","main/intro","main/paths","main/tools","main/tools_for_debug","main/writer"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,sphinx:56},filenames:["index.rst","main/apendixes.rst","main/application.rst","main/base.rst","main/calc.rst","main/config.rst","main/easymacro.rst","main/email.rst","main/examples.rst","main/examples_app.rst","main/examples_base.rst","main/examples_calc.rst","main/examples_draw.rst","main/examples_writer.rst","main/intro.rst","main/paths.rst","main/tools.rst","main/tools_for_debug.rst","main/writer.rst"],objects:{},objnames:{},objtypes:{},terms:{"0":[1,5,9,13,14,15,17],"008080":16,"02":14,"04":14,"06":[7,15,16],"07":14,"080315":16,"082211":16,"09":16,"0k":16,"1":[2,5,10,14,15,16,17],"10":[2,16],"100":11,"1090":1,"11":[14,16],"12":16,"125":16,"126446":16,"128487":16,"13":[7,16],"14":16,"15":16,"16":16,"17":16,"18":16,"19":16,"2":[2,5,10,15,16,17],"20":[14,16],"200":[11,16],"2001":10,"2002":10,"2003":10,"2004":10,"2005":10,"2021":[7,14,15,16],"21":[15,16],"22":16,"23":[7,14,16],"24":[7,15],"26":[7,16],"27":16,"29":15,"3":[5,10,14,15],"30":7,"300":11,"34":16,"35":16,"3m":16,"4":[10,15,16],"40":14,"400":11,"41":14,"42":16,"43":[7,16],"46":16,"47":[15,16],"48":16,"495":7,"5":[10,16],"50":14,"500":[11,17],"53":[14,16],"6":16,"7":14,"7iznrbyw":7,"8859":15,"9":5,"abstract":6,"case":16,"catch":6,"class":10,"default":[2,7,15,16],"do":15,"export":6,"extensi\u00f3n":5,"final":[1,14],"function":[14,17],"import":[1,2,3,4,6,7,10,15,16,17,18],"new":[1,5,6,10,12,14],"null":10,"opci\u00f3n":5,"public":5,"return":[2,9,10,11,12,13,16,17],"super":16,"true":[1,2,5,7,10,12,15,16],"while":2,A:5,And:17,FOR:5,For:[0,2,5,8,15,16],If:[5,6,7,17],In:[5,14,16],Is:[2,5,16],It:[5,6],Of:16,Ons:5,Or:15,The:5,To:6,With:[2,14],a1:[1,11],a2:1,absolut:5,academ:13,act:15,action:[15,16],activ:[2,6,13,17,18],active_sheet:[4,11],add:[5,14,15,17],addin:[5,14],addonmenu:5,address:7,all:[0,2,5,7,15],along:5,alt:[5,9],alwai:[1,2,3,4,6,7,15,16,17,18],an:[6,15],ani:[2,5,6,7,16,17],apendix:[0,2],api:[6,15,16],app:[1,2,3,4,6,7,9,10,11,12,13,15,16,17,18],app_nam:[15,16],applic:[0,5,6,8,16],april:11,apt:14,ar:[6,7,15,16],arbitrari:2,archlinux:14,arg:[2,16],argument:[2,5],ask:15,attach:7,automat:[5,11,17],autostyl:8,awt:2,b:[1,15],bar:2,base:[0,5,6,8],base_insert_data:10,base_select_data:10,basedatefield:10,basemodel:10,basic:[14,16],bcc:7,been:2,befor:[5,17],bergman:[7,10,16],best:16,better:[16,17],between:6,bin:[5,15],binari:6,blank:5,bmp:5,bodi:7,bool:5,born:10,both:16,box:6,build:15,bytesequ:1,c:14,cach:15,calc:[0,2,5,6,8,9,14,15],calc_data_to_cel:11,calcul:[11,16],call:6,call_dispatch:2,call_macro:16,can:[2,5,6,7,10,14,15,16,17],captur:16,catch_except:17,caution:[2,15,16],cc:7,cd:[5,14],cell:8,chang:15,charfield:10,client:7,clipboard:[2,8],clock:16,clone:14,close:[6,7,12],code:[5,6,17],color:6,color_html:16,color_nam:16,color_rgb:16,com:[1,2,7],command:[2,16],commandurl:9,common:2,complex:[6,16],compon:[5,14],compress:14,con:6,conf:[5,7,16],config:[7,15,16],configur:[0,6,7],confirm:15,connect:[3,7,10],contact:[10,16],contacto:10,contain:6,content:[2,15],context:[2,5,15],control:2,copi:[5,6,14,17],correctli:5,correo:7,cotillar:10,count:6,cours:[14,16],creat:[5,6,8,14],create_inst:2,create_t:10,cryptographi:16,csv:6,ctrl:[5,9],cuat:14,current:[5,6,16],custom:[6,8],danger:16,darkblu:16,darken:15,data:[1,2,6,8,9,16,17],data_to_dict:16,databas:[6,10],database_proxi:10,databaseproxi:10,date:[6,10,17],datetim:10,db:[3,10],de:5,debug:[0,2,6,7,9,15,16],decrypt:6,def:[2,9,10,11,12,13,16,17],defin:15,delet:[6,8],delete_menu:9,delin:15,descript:5,desktop1:2,desktop2:2,desktop:[2,16],detail:5,dev:14,develop:[5,6,14],dialog:2,dialogprovider2:2,dict:[7,10],dict_to_properti:16,dictionari:[5,6],difficult:17,digest:6,dir:6,dir_tmp:15,directli:[6,16],directori:[2,6,14],dispatch:6,displai:5,display_nam:5,displaynam:5,distribut:5,doc:[1,3,6,10,12,13,15],document:[2,6,12,16],documentservic:1,docx:2,domain:14,don:[14,15],done:14,download:[14,15,16],draw:[0,2,5,8],drwxr:16,ds:2,dt:15,each:5,easi:16,easili:6,easymacro:[0,1,2,3,4,7,10,15,16,17,18],echochar:16,edit:5,either:5,el:5,elmau:[5,14,15],els:10,email:[0,6],en:[1,5,6],enabl:1,encapsul:1,encapsulado:1,encod:15,encrypt:6,encrypt_decrypt:16,end:[2,16],ep:1,epoch:16,eps_encapsulated_postscript:1,epub:7,error:6,errorbox:16,es:[1,5],etc:2,even:5,everi:16,exactli:5,exampl:[0,2,5,9],excel_doc:2,except:6,execut:[6,10,16],exist:[2,6,10],exists_app:15,exit:15,ext:15,extens:[0,2,6,17],extensionnam:5,extern:6,extract:15,f:[1,2,5,15],fals:[1,2,10],februari:11,field:[1,7],file1:7,file2:7,file:[0,2,6,7,14],file_nam:[15,16],file_test:5,fileformatvers:1,filter:[0,6,15],filter_nam:2,filterservic:1,finish:16,first:0,fit:5,flag:1,folder:[5,7,15],fonda:10,fonst:6,font:2,forget:14,form:2,format:[2,5,6,7,16],foundat:5,frame:2,free:[2,5],fresh:14,from:[2,6,7,8,10,14],from_csv:15,from_id:15,from_json:15,galleri:2,gandi:7,gener:[5,14],get:[0,6,10],get_color:16,get_config:16,get_desktop:2,get_dir:15,get_epoch:16,get_fil:15,get_filt:[1,2],get_font:2,get_json:16,get_queri:10,git:14,gnome:16,gnu:[5,16],gran:5,great:5,ha:2,happi:6,have:[5,17],he:15,header:1,hello:[7,16],hi:15,hidden:[2,7,12,16],hide:2,himself:15,home:[2,3,5,6,7,10,12,16,17],hope:5,html:15,http:[5,14,16],httpx:16,i18n:5,i:[2,7,14,16],id:[6,10],id_ext:15,id_fold:15,id_par:15,idea:15,identityfield:10,idl:5,idlc:5,imag:[5,8,15],immedi:15,impli:5,impress:[2,5],impress_eps_export:1,includ:5,index:[0,9,15],info:[5,6,9,14],info_debug:[6,9,16],inform:[15,17],ingrid:[7,10,16],init:15,initi:10,inputbox:6,insert:[8,9],insert_menu_in_calc:9,instal:[0,5,6,10,16,17],instanc:[1,6],instruct:15,integ:5,intern:[2,5],introduct:0,invers:5,ipifi:16,is_dir:15,is_fil:15,is_mac:16,is_win:16,iso:15,issu:17,iter:6,jane:10,januari:11,jefferson:15,join:6,json:6,json_dump:16,json_load:16,jun:16,kei:5,keyboard:5,kill:15,kim:10,know:15,label:[5,9],lang:16,languag:[5,16],languaj:16,later:5,layer:6,legacy_table_nam:10,len:2,lessen:15,letmein:[2,16],letter_lov:16,lh:16,lib:5,librari:[0,1,2,3,4,7,9,15,16,18],libre_offic:15,libreoffic:[2,5,6,7,14,16,17],license_:5,license_en:5,light:15,like:5,limit:2,line:[2,16],link:5,linux:16,list:6,list_of_list:16,local:[7,14],log:6,logo:[5,15],look:[2,5,16],loren:[7,10],love:7,ls:16,lu20665x29msz:15,m:9,mac:16,macro:[5,6,8,9,14],mai:[11,16],mail1:7,mail2:7,mail3:7,mail:7,main:[2,16],major:6,make:[6,8,14],manag:5,mandatori:1,mani:2,march:11,marion:10,mau:[2,3,5,7,10,12,15,16,17],mbox:7,md:15,me:15,measur:16,member:15,memori:2,menu:8,menu_main:5,merchant:5,merg:15,merge_zip:15,messag:[6,7],message1:7,message2:7,meta:10,method:[6,15],mi:5,mine:15,model:10,modifi:[2,5],modul:[0,16],module1:16,month:11,more:[5,6,7,15,16],move:[5,14],mri:6,msg:[2,17],msgbox:[2,3,4,6,9,12,15,16,17,18],multi:5,multipl:15,mx:7,my:[0,5,9,16,17],my_app:16,my_extens:16,mydoc:2,myfil:[2,15],myfirstextens:14,myfirstextension_v0:14,mygreatextens:5,mymacro:9,n:[5,7,14,15],name:[1,4,6,9,10,15,16,17],name_16:5,name_26:5,nbest:7,need:[10,16,17],net:[5,7,14,15],new_nam:15,new_path:2,noexist:7,nombr:5,none:16,normal:[5,16],nosoffic:15,novak:10,now:[14,15,16],nwho:7,obj:[6,17],object:[2,6,17],od:[2,5,15],odb:[3,10],odt:[2,15,16],officemenubar:5,ok:16,one:[5,7,15,17],onli:[2,5,16],open:[5,6,12,17],oper:16,option1:5,option:[5,15],org:[5,16],origin:[2,6],os:[15,16],other:[2,7,15,16],other_nam:[2,15],ott:15,our:[],out:16,output:16,overview:0,oxt:[14,15],p:15,pacman:14,page:[0,5],paramet:0,part:5,particular:5,pass:5,password:[2,7,16],past:12,path:[0,3,6,7,10,12,16],path_dir:15,path_fil:15,path_hom:15,path_new:15,path_pygettext:5,path_python:15,path_sav:7,path_temp:15,path_tmp:15,path_url:15,path_zip:15,pathlib:15,pc:6,pdf:[6,15],peewe:10,pictur:[12,15,16],pip:10,planet:17,pleas:[5,17],png:[5,15,16],popen:16,port:7,possibl:[5,7],postscript:1,pot:[5,14],present:1,presentationdocu:1,previous:2,print:[2,10],privat:16,probabl:6,problem:17,process:17,product:[8,17],program:6,project:[5,14,15,16,17],properti:[5,6],provid:14,prueba:5,publish:5,purpos:5,py:[0,2,5,14],python3:5,python:[6,14,16],pyuno:[2,17],queri:10,question:6,r:[16,17],rang:[2,11],rapid:14,rdb:5,read:[2,6],read_bin:15,receiv:[5,15],recommend:[5,14],recurs:15,redistribut:5,regard:[7,16],regmerg:5,rel:5,rememb:[1,2,3,4,7,15,16,18],remerg:5,remov:9,render:6,replac:6,replace_ext:15,repositori:14,request:16,requir:0,respond:7,result:[2,15,16],row:10,rtf:2,run:16,run_in_thread:[2,16],runtimeuid:2,rw:16,s:[5,6,14],safe_for_delet:15,same:[5,15,16],save:[6,7,8,17],save_bin:15,save_data:16,save_image_from_clipboard:12,save_log:17,save_tmp:15,sb:2,script:14,sdk:[5,14],search:0,second:16,secret:16,secur:7,see:5,select:[6,8],semant:5,send:[6,16],send_email:7,sent:7,server:7,servic:2,set:[2,5,8,15],set_config:16,setvalu:2,sha256:16,sha512:16,share:5,sheet:[0,6,11],shell:17,shift:[5,9],shortcut:[5,9],should:5,show:[2,5,6,9,17],show_info_debug:9,show_messag:16,show_tim:16,simpl:6,size:[11,15],sleep:[2,16],soffic:[5,15],sofia:10,softwar:5,sometim:17,sophia:7,sourc:[14,15],space:5,srv:[2,15],ssl:7,standard:16,star:[1,2],start:[2,5,14,16,17],start_clock:16,start_tim:16,statu:2,stop:16,stop_clock:16,stop_tim:16,string:[5,6],style:13,stylenam:2,sub:16,subdir:15,subdirectori:15,subject:7,submenu:9,successfulli:14,sudo:14,sun:[1,2],support:[2,14,16],svfilteroptionsdialog:1,svg:15,svtool:1,system:[6,16],t:[5,14,15],t_shift_mod1_mod2:5,tabl:8,taper:15,target:[12,15],technic:16,temp:6,temp_dir:15,templat:16,templatenam:1,tempor:6,teresa:17,term:5,test:[2,10,14,15,16,17],text:[2,5,6,16],than:7,thi:[2,5,14,15,16,17],thing:2,thoma:15,thread:[2,6,7],three:[15,17],thunderbird:7,ticket:17,time:[6,17],timer:6,timer_nam:16,titl:[5,16],tmp:15,tmp_:15,to_csv:15,to_json:15,to_pdf:2,to_system:15,to_url:15,todai:16,token:16,too:[5,7,16],tool:[0,5,6,9],toolbar:5,toolkit:2,total:[11,16],tu:5,tupl:[5,6,10,15],tuple_of_tupl:16,two:[5,15],txt:[15,17],type:[1,3,4,6,16,18],type_extens:5,u:10,ubuntu:14,ui:2,uicompon:1,uinam:[1,2],under:5,uniqu:5,uno:[2,6],uno_packag:15,unopkg:[5,14],unzip:6,update_status_bar:2,urd:5,url:[5,6],url_open:16,us:[1,2,5,6,7,8,14,15,16,17],use_local:5,user:[7,14,15,16],userdata:1,usr:5,utf8:15,v:5,valor:5,valu:[2,5],variant:16,verifi:[6,17],version:16,video:16,vim:5,visibl:[],wai:[7,15],walk:15,walk_dir:15,want:[5,15],warn:6,warranti:5,we:7,web:16,what:5,when:[5,15],where:5,who:15,window:16,without:[2,5,15],wizard:5,work:16,writer:[0,2,5,6,8],writer_table_set_styl:13,www:5,x:16,xl:2,xlsx:2,xml:15,xpathset:15,xr:16,you:[2,5,6,7,10,14,15,16,17],your:[5,6,7,16,17],yournam:5,zaz:[5,9,14,15],zazeasymacro_v0:15,zip:6,zip_cont:15},titles:["Welcome to ZAZ\u2019s documentation!","Apendixes","Application","Base","Calc","Configuration","Library easymacro.py","Email","Examples","For Application","For Base","For Calc","For Draw","For Writer","Introduction","Paths and files","Tools","Tools for debug","Writer"],titleterms:{"catch":17,"default":5,"export":2,"function":5,"new":[2,3],For:[9,10,11,12,13],If:2,To:2,activ:4,all:1,ani:15,apendix:1,applic:[2,9,15],author:5,autostyl:13,base:[3,10],binari:15,box:[16,17],calc:[1,4,11],call:[2,16,17],cell:11,clipboard:12,close:2,color:16,configur:[5,15,16],contain:2,content:[0,6,8],copi:[2,15],count:2,creat:[2,10],csv:15,current:[2,4,18],custom:9,data:[10,11,15],databas:3,date:16,debug:17,decrypt:16,delet:[9,15],dictionari:16,digest:16,dir:[2,15],directori:15,dispatch:2,doc:[2,4,18],document:[0,15],domain:5,draw:12,easymacro:6,email:7,encrypt:16,error:[16,17],exampl:8,except:17,execut:15,exist:15,extens:[5,14,15],extern:16,file:[5,15,17],file_nam:2,filter:[1,2],first:14,fonst:2,format:15,from:[12,15,16],get:[1,2,15,16],home:15,icon:5,id:[5,15],imag:12,indic:0,info:[15,16,17],info_debug:17,inform:5,inputbox:16,insert:10,instal:[14,15],instanc:2,introduct:14,is_modifi:2,is_read_onli:2,is_sav:2,iter:2,join:15,json:[15,16],librari:6,libreoffic:15,licens:5,list:16,local:5,log:17,macro:16,main:5,make:[9,16],menu:[5,9],messag:[16,17],method:2,mri:17,my:14,name:[2,5],obj:2,open:[2,15,16],overview:14,paramet:5,parent:5,past:2,path:[2,5,15],pc:16,pdf:2,program:[5,16],properti:[2,16],py:6,pygettext:5,python:15,question:16,read:15,render:16,replac:15,requir:14,s:0,save:[2,12,15,16],select:[2,10,15],send:7,set:13,set_focu:2,sheet:[1,4],show:16,simpl:16,status_bar:2,string:16,system:15,tabl:[0,10,13],temp:15,tempor:15,test:5,text:15,thread:16,time:16,timer:16,titl:2,tool:[16,17],tupl:16,type:[2,5,15],uid:2,unzip:15,url:[15,16],verifi:15,version:5,visibl:2,warn:16,welcom:0,writer:[13,18],zaz:0,zip:15,zoom:2}}) \ No newline at end of file diff --git a/doc/source/main/application.rst b/doc/source/main/application.rst index 35f7ee8..0f45df2 100644 --- a/doc/source/main/application.rst +++ b/doc/source/main/application.rst @@ -231,8 +231,20 @@ Export filter_name = 'doc' doc.export(path, filter_name) + path = '/home/mau/myfile.rtf' + filter_name = 'rtf' + doc.export(path, filter_name) + * For all support formats look `Apendix`_ +* Export in memory. + +.. code-block:: python + + doc = app.docs.new() + filter_name = 'xlsx' + excel_doc = doc.export(filter_name=filter_name) + Fonst ^^^^^ @@ -395,7 +407,102 @@ name app.msgbox(doc.file_name) +visible +~~~~~~~ +* Hide or show document. + +.. code-block:: python + + doc = app.active + doc.visible = False + app.msgbox(doc.visible) + doc.visible = True + + +zoom +~~~~ + +* Get or set zoom value. + +.. code-block:: python + + doc = app.active + zoom = doc.zoom + app.msgbox(zoom) + doc.zoom = zoom * 2 + app.msgbox(doc.zoom) + doc.zoom = zoom + + +selection +~~~~~~~~~ + +* **CAUTION**: Selection can be many things. + +.. code-block:: python + + doc = app.active + selection = doc.selection + app.msgbox(selection) + + +status_bar +~~~~~~~~~~ + +* Get status bar, always control in other thread. + +.. code-block:: python + + @app.run_in_thread + def update_status_bar(sb, text, limit): + sb.start(text, limit) + for i in range(limit): + sb.setValue(i) + app.sleep(1) + # ~ Is important free status bar + sb.end() + return + + def main(): + doc = app.active + update_status_bar(doc.status_bar, 'Line', 10) + return + + +Methods +^^^^^^^ + +set_focus +~~~~~~~~~ + +.. code-block:: python + + name = 'MyDoc.ods' + if name in app.docs: + doc = app.docs[name] + doc.set_focus() + +copy +~~~~ + +* Copy current selection + +.. code-block:: python + + doc = app.active + doc.copy() + + +paste +~~~~~ + +* Paste any content in clipboard + +.. code-block:: python + + doc = app.active + doc.paste() .. _dispatch command: https://wiki.documentfoundation.org/Development/DispatchCommands diff --git a/doc/source/main/calc.rst b/doc/source/main/calc.rst index b6ce700..71ab0a0 100644 --- a/doc/source/main/calc.rst +++ b/doc/source/main/calc.rst @@ -2,7 +2,7 @@ Calc ---- -Remember, always import library. +Remember, always import library. .. code-block:: python @@ -18,8 +18,11 @@ Current doc app.msgbox(doc.type) +Sheets +^^^^^^ + Active sheet -^^^^^^^^^^^^ +~~~~~~~~~~~~ .. code-block:: python diff --git a/source/easymacro.py b/source/easymacro.py index 15648a0..6b7292d 100644 --- a/source/easymacro.py +++ b/source/easymacro.py @@ -1121,10 +1121,6 @@ class LODocument(object): def name(self): return _P(self.path).name - @property - def status_bar(self): - return self._cc.getStatusIndicator() - @property def visible(self): w = self.frame.ContainerWindow @@ -1163,7 +1159,6 @@ class LODocument(object): @property def selection(self): sel = self.obj.CurrentSelection - # ~ return _get_class_uno(sel) return sel @property @@ -1171,6 +1166,11 @@ class LODocument(object): taf = create_instance('com.sun.star.sheet.TableAutoFormats') return taf.ElementNames + @property + def status_bar(self): + bar = self._cc.getStatusIndicator() + return bar + def create_instance(self, name): obj = self.obj.createInstance(name) return obj @@ -1199,10 +1199,11 @@ class LODocument(object): self._cc.select(obj) return - def to_pdf(self, path: str='', args: dict={}): + def to_pdf(self, path: str='', options: dict={}): """ https://wiki.documentfoundation.org/Macros/Python_Guide/PDF_export_filter_data """ + args = options.copy() stream = None path_pdf = 'private:stream' if path: @@ -1229,40 +1230,56 @@ class LODocument(object): return stream - def export(self, path: str, filter_name: str, args: dict={}): + def export(self, path: str='', filter_name: str='', options: dict={}): FILTERS = { 'xlsx': 'Calc MS Excel 2007 XML', 'xls': 'MS Excel 97', 'docx': 'MS Word 2007 XML', 'doc': 'MS Word 97', + 'rtf': 'Rich Text Format', } + args = options.copy() + stream = None + path_target = 'private:stream' + if path: + path_target = _P.to_url(path) + filter_name = FILTERS.get(filter_name, filter_name) filter_data = dict_to_property(args, True) args = { 'FilterName': filter_name, 'FilterData': filter_data, } + if not path: + stream = IOStream.output() + args['OutputStream'] = stream + opt = dict_to_property(args) try: - self.obj.storeToURL(_P.to_url(path), opt) + self.obj.storeToURL(path_target, opt) except Exception as e: error(e) - path = '' - return _P.exists(path) + if not stream is None: + stream = stream.buffer - def save(self, path: str='', args: dict={}) -> bool: - result = True - opt = dict_to_property(args) - if path: - try: - self.obj.storeAsURL(_P.to_url(path), opt) - except Exception as e: - error(e) - result = False - else: + return stream + + def save(self, path: str='', options: dict={}): + if not path: self.obj.store() - return result + return + + args = options.copy() + path_target = _P.to_url(path) + + opt = dict_to_property(args) + try: + self.obj.storeAsURL(path_target, opt) + except Exception as e: + error(e) + + return def close(self): self.obj.close(True) @@ -6140,6 +6157,7 @@ class LODBServer(object): self._conn = None self._error = 'Not connected' self._type = '' + self._drivers = [] def __str__(self): return f'DB type {self._type}' @@ -6158,13 +6176,19 @@ class LODBServer(object): def error(self): return self._error + @property + def drivers(self): + return self._drivers + def disconnet(self): if not self._conn is None: if not self._conn.isClosed(): self._conn.close() self._conn.dispose() + return - def connect(self, args): + def connect(self, options={}): + args = options.copy() self._error = '' self._type = args.get('type', 'postgres') driver = self.DRIVERS[self._type] @@ -6175,9 +6199,14 @@ class LODBServer(object): password = args['password'] data = {'user': user, 'password': password} + # ~ 'JavaDriverClass': 'org.mariadb.jdbc.Driver'} url = f'sdbc:{driver}://{server}:{port}/{dbname}' + # ~ https://downloads.mariadb.com/Connectors/java/ + # ~ url = f'jdbc:mysql://{server}:{port}/{dbname}' + args = dict_to_property(data) manager = create_instance('com.sun.star.sdbc.DriverManager') + self._drivers = [d.ImplementationName for d in manager] try: self._conn = manager.getConnectionWithInfo(url, args) @@ -6187,6 +6216,18 @@ class LODBServer(object): return self + def execute(self, sql): + query = self._conn.createStatement() + try: + query.execute(sql) + result = True + except Exception as e: + error(e) + self._error = str(e) + result = False + + return result + def create_window(args): return LOWindow(args)