#-*- coding: utf-8 -*-
GlobalPVersion='2.1.5'
import time,datetime,sys,os,os.path,itertools,shutil,locale,math,re,mmap
import win32api,win32con,win32gui,win32com.client,win32clipboard
import _winreg
import urllib,urllib2,base64,binascii,time
import htmlentitydefs
try:
name, ponxdir, typ = _winreg.EnumValue(_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\CLSID\{EC501258-201C-449C-BE20-837A316EA382}\PythonCOMPath'), 0)
ponxdir+='\\'
if not sys.path.__contains__(ponxdir[:-1]): sys.path.append(ponxdir[:-1])
except:
ponxdir=os.getcwd()+'\\'
#import ponx
#import pxie
import pywig
import theconfig
def clipboardtxt(chaine=None):
try:
win32clipboard.OpenClipboard()
if (chaine is None) or (chaine==""):
try:
chaine=win32clipboard.GetClipboardData(win32con.CF_TEXT)
#win32clipboard.EmptyClipboard()
#win32clipboard.SetClipboardText(chaine)
return(chaine)
except:
return('')
else:
try:
win32clipboard.EmptyClipboard()
win32clipboard.SetClipboardText(chaine)
#print 41,chaine,type(chaine)
#win32clipboard.SetClipboardData(win32con.CF_TEXT,chaine)
except:
pass
except:
pass
try:
win32clipboard.CloseClipboard()
except:
pass
def calendrierhtml(annee,mois,taille='60%',cadre='OUI'):
"""
Crée un tableau en HTML (compatible THE) du calendrier d'un mois
retourne le HTML
"""
import calendar,locale
locale.getlocale() # (None, None)
locale.setlocale(locale.LC_ALL, "") # FrenchçFrance
calendar.setfirstweekday(calendar.MONDAY) # semaine commençant le lundi
tmpcadre = 'border-collapse: collapse; border-style: solid; border-width: 1px; border-color: #cccccc;'
tdstyle = ' style="border-style: solid; border-width: 1px; border-color: #cccccc; BACKGROUND-COLOR: #ffffff;"'
if cadre.upper() !='OUI':
tmpcadre = 'border-style: none'
tdstyle = ' style="BACKGROUND-COLOR: #ffffff;"'
titre='
'+str(annee)+'.'+str(mois)+'
'
tableau = titre+'
'
tableau += '';
tableau += 'Lu | '
tableau += 'Ma | '
tableau += 'Me | '
tableau += 'Je | '
tableau += 'Ve | '
tableau += 'Sa | '
tableau += 'Di | '
tableau += '
';
for w in calendar.monthcalendar(annee,mois):
tableau += '';
for j in w:
tableau += ''
if j>0:
tableau += str(j)
tableau += ' | '
tableau += '
'
tableau += '
';
return tableau
clipBuffer1=''
clipBuffer2=''
clipBuffer3=''
clipBuffer4=''
clipBuffer5=''
def choixclip():
wpp=pywig.win(u"Presse-papier bufferisé",-1,-1,600,570)
wpp.setprop(fond=(210,240,240))
wpp.setprop(CAPTION=True,
SYSMENU=True,
MINIMIZEBOX=False,
MAXIMIZEBOX=False,
THICKFRAME=True,
POPUP=False)
wpp.add_label(texte=clipBuffer1,x=80,y= 30,l=490,h=90,multiligne=True)
wpp.add_label(texte=clipBuffer2,x=80,y=130,l=490,h=90,multiligne=True)
wpp.add_label(texte=clipBuffer3,x=80,y=230,l=490,h=90,multiligne=True)
wpp.add_label(texte=clipBuffer4,x=80,y=330,l=490,h=90,multiligne=True)
wpp.add_label(texte=clipBuffer5,x=80,y=430,l=490,h=90,multiligne=True)
bt1 = wpp.add_bouton(texte="Copier", x=5,y= 30, l=74,h=30, fonction=wpp.ferme)
bt2 = wpp.add_bouton(texte="Copier", x=5,y=130, l=74,h=30, fonction=wpp.ferme)
bt3 = wpp.add_bouton(texte="Copier", x=5,y=230, l=74,h=30, fonction=wpp.ferme)
bt4 = wpp.add_bouton(texte="Copier", x=5,y=330, l=74,h=30, fonction=wpp.ferme)
bt5 = wpp.add_bouton(texte="Copier", x=5,y=430, l=74,h=30, fonction=wpp.ferme)
wpp.define(auto='NO')
wpp.run()
vret=''
try:
bouton=wpp.allobj[wpp.derCommand]
if bouton==bt1:
vret=clipBuffer1
elif bouton==bt2:
vret=clipBuffer2
elif bouton==bt3:
vret=clipBuffer3
elif bouton==bt4:
vret=clipBuffer4
elif bouton==bt5:
vret=clipBuffer5
except:
pass
del wpp
return vret
def partableau():
def fboutonok(w,id,typevent, *suite):
w.calcresult()
w.ferme()
wt=pywig.win(u"Paramètres du tableau",-1,-1,400,270)
wt.setprop(fond=(192,230,230))
wt.setprop(CAPTION=True,
SYSMENU=True,
MINIMIZEBOX=False,
MAXIMIZEBOX=False,
THICKFRAME=True,
POPUP=False)
nbcol = wt.add_edit()
wt.add_label("Nb colonnes")
nblig = wt.add_edit()
wt.add_label("Nb lignes")
largeur = wt.add_edit()
wt.add_label("largeur %")
cadre = wt.add_edit()
wt.add_label("Cadres oui/non")
btok = wt.add_bouton(texte="Valider")
btquit= wt.add_bouton(texte="Abandonner")
wt.graindesel(btok,fboutonok, btquit,wt.ferme)
wt.define(auto=None)
nbcol.focus()
time.sleep(0.250)
wt.run()
if wt.result=={}:
vret=()
else:
vret=(wt.result[2001][0],wt.result[2002][0],wt.result[2003][0],wt.result[2004][0].upper())
del wt
return vret
def anneemois():
def fboutonok(w,id,typevent, *suite):
w.calcresult()
w.ferme()
wm=pywig.win(u"Année et Mois")
wm.setprop(x=-1,y=-1,l=300,h=200)
wm.setprop(fond=(200,210,210))
annee=wm.add_edit(120,25,150)
mois=wm.add_edit(120,65,150)
wm.add_label(u"Année",15,22)
wm.add_label(u"Mois",15,62)
btok = wm.add_bouton(texte="Valider")
btquit= wm.add_bouton(texte="Abandonner")
wm.createmenu(contextmenu=u"""
9001 Quitter le menu
9002 Valider
9003 Abandonner
DEFAULT:9002
""")
wm.graindesel(9002,wm.valide)
wm.graindesel(9003,wm.abandon)
#wm.graindeselkey(VK_ESCAPE=wm.ferme)
wm.graindesel(btok,fboutonok, btquit,wm.ferme)
wm.define(auto="NO")
wm.ctrlfocus(annee)
time.sleep(0.250)
wm.run()
vret=(None,None)
try:
vret=(wm.result[2001][0],wm.result[2002][0])
except:
pass
del wm
return vret
def sainombre():
def fboutonok(w,id,typevent, *suite):
w.calcresult()
w.ferme()
wm=pywig.win(u"Nombre")
wm.setprop(x=-1,y=-1,l=300,h=160)
wm.setprop(fond=(200,210,210))
nb=wm.add_edit(120,25,150)
wm.add_label(u"Nb :",15,22)
btok = wm.add_bouton(texte="Valider")
btquit= wm.add_bouton(texte="Abandonner")
wm.createmenu(contextmenu=u"""
9001 Quitter le menu
9002 Valider
9003 Abandonner
DEFAULT:9002
""")
wm.graindesel(9002,wm.valide)
wm.graindesel(9003,wm.abandon)
wm.graindesel(btok,fboutonok, btquit,wm.ferme)
wm.define(auto="NO")
wm.ctrlfocus(nb)
time.sleep(0.250)
wm.run()
vret=(None,None)
try:
vret=(wm.result[2001][0])
except:
pass
del wm
return vret
def pub(txt='',duree=0):
ww=pywig.win("",-1,-1,480+(pywig.metric.SM_CXSIZEFRAME-pywig.metric.SM_CXBORDER)*2,240+(pywig.metric.SM_CYSIZEFRAME-pywig.metric.SM_CYBORDER)*2+60)
ww.setprop(THICKFRAME = True,
POPUP = True,
VISIBLE = True,
CAPTION = False,
SYSMENU = False,
SETFONT = False,
MINIMIZEBOX = False)
ww.fond=(255,255,255)
image=ww.add_image(os.path.dirname(__file__)+"\\the.jpg")
def suiviclic(w,x,y,*suite):
c=int((x-0)/24)
l=int((y-0)/32)
w.ferme()
ww.add_font("CO24","Comic Sans MS", 24)
ww.add_text(texte=txt,x=0,y=250,l=472,h=40, multiligne=True, font="CO24", textcolor=(64,64,200))
ww.graindesel("CLICK",suiviclic)
ww.define(auto=None)
if duree>0:
ww.run(dureemax=duree)
#time.sleep(duree)
#ww.ferme()
else:
return ww
if not os.path.isfile(os.path.dirname(__file__)+'\\the.htm'):
pywig.forcehtm()
def preparehtml(purl=None):
#pywig.prparehtmlmanaged("file:///"+the.dirtravail+"/the.htm")
if not pywig.flagpreparehtmlmanaged:
#pywig.prparehtmlmanaged("file:///"+os.path.dirname(__file__)+"/the.htm")
pywig.prparehtmlmanaged(purl)
def the(dirtravail=None, fichier=None):
#print 335,dirtravail, fichier
if dirtravail is None:
the.dirtravail=os.getcwd()
else:
the.dirtravail=dirtravail
if the.dirtravail[-1]=="\\":
the.dirtravail=the.dirtravail[:-1]
the.fichier=fichier
"""
OK 09:48
preparehtml()
"""
preparehtml(os.path.dirname(__file__)+"/the.htm")
time.sleep(0.025)
if theconfig.pub:
ww=pub(u"Version "+GlobalPVersion,duree=0)
for i in range(theconfig.pubdelai):
time.sleep(0.001)
time.sleep(0.250)
def fbt1(w,id,typevent,*suite):
w.callmenu()
def test(w,id,typevent,*suite):
thed.test()
def publicite(*suite):
import random
if random.random()<0.6:
ww=pub(u"Version "+GlobalPVersion,duree=12)
else:
ww=pub(u"Michel Claveau informatique - http://mclaveau.com",duree=12)
def voirnavigateur(w,id,typevent,*suite):
thed.focus()
thed.voirnavigateur()
def chercher(w,id,typevent,*suite):
thed.focus()
pywig.keyb('f',shift=False,control=True)
def setimage(w,id,typevent,*suite):
fichier=pywig.choixfichier(the.dirtravail,'image\0*.jpg;*.jpeg;*.png;*.gif;*.bmp\0')
#print 318,
#print fichier
#print the.dirtravail+"\\"+fichier
#import ponx
#ponx.msginfo('347',fichier)
if fichier != '':
#time.sleep(0.1250)
thed.image(fichier)
#time.sleep(0.250)
#time.sleep(0.250)
def ilistnum(w,id,typevent,*suite):
thed.autoformat('InsertOrderedList')
def ilistbrut(w,id,typevent,*suite):
thed.autoformat('InsertUnorderedList')
def iancre(w,id,typevent,*suite):
thed.autoformatsaisie('CreateBookmark', u'Ancre (sélectionner mini un caractère)', '#A001')
def ilien(w,id,typevent,*suite):
thed.autoformat3('CreateLink')
def ibouton(w,id,typevent,*suite):
thed.autoformatsaisie('InsertButton', 'ID du bouton', 'BOUTON01')
def iligne(w,id,typevent,*suite):
thed.autoformat('InsertHorizontalRule')
def ibloctext(w,id,typevent,*suite):
thed.autoformat('InsertFieldset')
def iimage2(w,id,typevent,*suite):
thed.autoformatsaisie('InsertImage', u'Nom + chemin du fichier-image (attention à la casse)', '.jpg')
def ifichier(w,id,typevent,*suite):
fichier=pywig.choixfichier(the.dirtravail,'Tous les fichiers\0*.*\0')
if fichier != '':
thed.autoformat2('CreateLink',fichier)
def iinput(w,id,typevent,*suite):
thed.autoformatsaisie('InsertInputButton', 'ID du bouton', 'BOUTON02')
def ichamptext(w,id,typevent,*suite):
thed.autoformatsaisie('InsertInputText', 'ID du Champ', 'CH01')
def itextarea(w,id,typevent,*suite):
thed.autoformatsaisie('InsertTextArea', 'ID du Champ', 'CH02')
def ilistbox(w,id,typevent,*suite):
thed.autoformatsaisie('InsertSelectListbox', 'ID du Champ', 'CH03')
def ilistderoulante(w,id,typevent,*suite):
thed.autoformatsaisie('InsertSelectDropdown', 'ID du Champ', 'CH04')
def isubmit(w,id,typevent,*suite):
thed.autoformatsaisie('InsertInputSubmit', 'ID du Bouton', 'SUBMIT01')
def ireset(w,id,typevent,*suite):
thed.autoformatsaisie ('InsertInputReset', 'ID du Bouton', 'RESET01')
def undo(w,id,typevent,*suite):
thed.undo()
def redo(w,id,typevent,*suite):
thed.redo()
def indente(w,id,typevent,*suite):
thed.indente()
def desindente(w,id,typevent,*suite):
thed.desindente()
def ecrase(w,id,typevent,*suite):
thed.ecrase()
def basculesource(w,id,typevent,*suite):
thed.basculesource()
def supprimeformat(w,id,typevent,*suite):
thed.supprimeformat()
def copyhtmlclipboard(w,id,typevent,*suite):
thed.copyhtmlclipboard(quoi="SELECTION")
def memorizeclipboard(w,id,typevent,*suite):
global clipBuffer1, clipBuffer2, clipBuffer3, clipBuffer4, clipBuffer5
ttt=thed.memorizeclipboard()
clipBuffer5 = clipBuffer4
clipBuffer4 = clipBuffer3
clipBuffer3 = clipBuffer2
clipBuffer2 = clipBuffer1
clipBuffer1 = ttt
def pasteclipboard(w,id,typevent,*suite):
ttt=choixclip()
if ttt != "":
thed.pasteclipboard(ttt)
def gras(w,id,typevent,*suite):
thed.gras()
def souligne(w,id,typevent,*suite):
thed.souligne()
def italique(w,id,typevent,*suite):
thed.italique()
def barre(w,id,typevent,*suite):
thed.barre()
def exposant(w,id,typevent,*suite):
thed.exposant()
def indice(w,id,typevent,*suite):
thed.indice()
def agauche(w,id,typevent,*suite):
thed.agauche()
def acentre(w,id,typevent,*suite):
thed.acentre()
def adroite(w,id,typevent,*suite):
thed.adroite()
def forecouleur(w,id,typevent,*suite):
color=pywig.choixcouleur()
hcolor=str(hex(4096+color[0]))[4:6]+str(hex(4096+color[1]))[4:6]+str(hex(4096+color[2]))[4:6]
thed.forecolor(hcolor)
def forerouge(w,id,typevent,*suite):
thed.forecolor('FF0000')
def forevert(w,id,typevent,*suite):
thed.forecolor('00FF00')
def forebleu(w,id,typevent,*suite):
thed.forecolor('0000FF')
def foreblanc(w,id,typevent,*suite):
thed.forecolor('FFFFFF')
def forenoir(w,id,typevent,*suite):
thed.forecolor('000000')
def foregris(w,id,typevent,*suite):
thed.forecolor('808080')
def forejaune(w,id,typevent,*suite):
thed.forecolor('FFFF00')
def forerougef(w,id,typevent,*suite):
thed.forecolor('800000')
def forebleuf(w,id,typevent,*suite):
thed.forecolor('000080')
def forevertf(w,id,typevent,*suite):
thed.forecolor('008000')
def backcouleur(w,id,typevent,*suite):
color=pywig.choixcouleur()
hcolor=str(hex(4096+color[0]))[4:6]+str(hex(4096+color[1]))[4:6]+str(hex(4096+color[2]))[4:6]
thed.backcolor(hcolor)
def backrouge(w,id,typevent,*suite):
thed.backcolor('FF0000')
def backrougef(w,id,typevent,*suite):
thed.backcolor('800000')
def backbleuf(w,id,typevent,*suite):
thed.backcolor('000080')
def backgrisf(w,id,typevent,*suite):
thed.backcolor('606060')
def backjaune(w,id,typevent,*suite):
thed.backcolor('FFFF00')
def backnoir(w,id,typevent,*suite):
thed.backcolor('000000')
def backblanc(w,id,typevent,*suite):
thed.backcolor('FFFFFF')
def fontarial(w,id,typevent,*suite):
thed.font('Arial')
def fonttimes(w,id,typevent,*suite):
thed.font('Times new roman')
def fontcomic(w,id,typevent,*suite):
thed.font('Comic sans MS')
def fontcourier(w,id,typevent,*suite):
thed.font('Courier New')
def font1(w,id,typevent,*suite):
thed.fontsize(1)
def font2(w,id,typevent,*suite):
thed.fontsize(2)
def font3(w,id,typevent,*suite):
thed.fontsize(3)
def font4(w,id,typevent,*suite):
thed.fontsize(4)
def font5(w,id,typevent,*suite):
thed.fontsize(5)
def font6(w,id,typevent,*suite):
thed.fontsize(6)
def font7(w,id,typevent,*suite):
print 614
thed.fontsize(7)
def itableau(w,id,typevent,*suite):
pars = partableau()
if pars != ():
thed.tableau(*pars)
def imois(w,id,typevent,*suite):
annee,mois=anneemois()
if annee is None: return
if annee=="": return
if int(annee)<1: return
if mois is None: return
if mois=="": return
if int(mois)<1: return
thtml=calendrierhtml(int(annee),int(mois),taille='50%',cadre='OUI')
thed.inserehtml(thtml)
def tcouleur(w,id,typevent,*suite):
color=pywig.choixcouleur()
#time.sleep(0.250)
try:
thed.dercouleurutilisee=color
hcolor=str(hex(4096+color[0]))[4:6]+str(hex(4096+color[1]))[4:6]+str(hex(4096+color[2]))[4:6]
thed.tdfond(hcolor)
except:
pass
def tcouleurmultiple(w,id,typevent,*suite):
color=pywig.choixcouleur()
nb=sainombre()
#time.sleep(0.250)
try:
thed.dercouleurutilisee=color
hcolor=str(hex(4096+color[0]))[4:6]+str(hex(4096+color[1]))[4:6]+str(hex(4096+color[2]))[4:6]
thed.tdfondmultiple(hcolor,nb)
except:
pass
def trepetecouleur(w,id,typevent,*suite):
color=thed.dercouleurutilisee
try:
hcolor=str(hex(4096+color[0]))[4:6]+str(hex(4096+color[1]))[4:6]+str(hex(4096+color[2]))[4:6]
thed.tdfond(hcolor)
except:
pass
def tinslig(w,id,typevent,*suite):
thed.tableauinslig()
def tdellig(w,id,typevent,*suite):
thed.tableaudellig()
def tinscol(w,id,typevent,*suite):
thed.tableauinscol()
def tdelcol(w,id,typevent,*suite):
thed.tableaudelcol()
def tfusionnesuive(w,id,typevent,*suite):
thed.tableaufusionsuivante()
def abandonner(w,id,typevent,*suite):
w.ferme()
def quitter(w,id,typevent,*suite):
#the.html=thed.source()
sauver(w,id,typevent,suite)
w.ferme()
time.sleep(0.250)
def repetercommande(w,*par):
w.repetedernierecommand()
time.sleep(0.250)
def ouvrir(w,id,typevent,*suite):
fichier=pywig.choixfichier(the.dirtravail,'HTML\0*.htm;*.html;*.hta\0')
if fichier != '':
if fichier.find("\\")>-1:
the.dirtravail=os.path.dirname(fichier)
else:
the.dirtravail=os.getcwd()
fichier=the.dirtravail+"\\"+fichier
if the.fichier != fichier:
the.fichier = fichier
the.html=open(fichier,"r").read()
thed.source(the.html)
def sauver(w,id,typevent,*suite):
the.html=thed.source()
try:
open(the.fichier,"w").write(the.html)
except:
open(the.fichier,"w").write(the.html.encode('utf-8','replace'))
GuiLarg=1024
GuiHaut=680
the.RTobj=None
the.RTwin=None
w=pywig.win("THE>>>", -1,10,GuiLarg,GuiHaut)
w.setprop(CAPTION=True, fond=(160,210,210))
margebasse=win32api.GetSystemMetrics(win32con.SM_CYFRAME)+ \
win32api.GetSystemMetrics(win32con.SM_CYCAPTION)+ \
win32api.GetSystemMetrics(win32con.SM_CYFRAME)+ \
30
bt1 = w.add_bouton(texte="{Echap} Menu", x=0,y=0, l=100,h=30, fonction=fbt1)
bt2 = w.add_bouton("Pub", 100,0, 30,30, fonction=publicite)
etatstatut=w.add_text(u"Etat:", GuiLarg-110,0,300,15,False)
etatstatut2=w.add_text(u" ", GuiLarg-114,8,300,15,False)
st=u"""
9500 rien (fermer le menu)
9501 +&Edit
9521 &UnDO
9522 &ReDO
9523 &Indente
9524 &Dé-indente
9525 &Ecrasement ou Insertion (bascule)
9526 &Source/Wysiwyg (bascule)
9527 supprime le &Formatage
9528 c&Opier dans le presse-papier bufferisé (Ctrl+Alt+C)
9529 co&Ller depuis le presse-papier bufferisé (Ctrl+Alt+V)
9502 +&Attribut
9530 &Gras
9531 &Souligné
9532 &Italique
9533 &Barré
9534 &Exposant
9535 &Indice
9502 +a&Lignement
9541 &Gauche
9542 &Centrer
9543 &Droite
9503 +&Kouleur (couleur)
9570 &Choix couleur
9518 ----
9571 &Rouge
9572 &Vert
9573 &Bleu
9574 bl&Anc
9575 &Noir
9576 &Gris
9577 &Jaune
9578 rouge &Foncé
9579 bleu foncé
9580 vert foncé
9518 ----
9581 Fond Choix couleur
9518 ----
9582 fond Rouge
9583 fond Rouge foncé
9584 fond Bleu foncé
9585 fond Gris foncé
9586 fond &Jaune
9587 fond Noir
9588 fond Blanc
9504 +&Police
9610 &Arial (Helvetica, sans serif)
9611 &Times (serif)
9612 &Comic sans MS
9613 c&Ourier (espacement fixe)
9514 ----
9615 Taille &1
9616 Taille &2
9617 Taille &3
9618 Taille &4
9619 Taille &5
9620 Taille &6
9621 Taille &7
9505 &UnDO
9506 +&Insertion d'élément
9550 &Liste numérotée
9551 &Liste brute
9552 &Ancre
9553 &Lien
9554 &Bouton
9555 &Ligne horizontale
9556 &Bloc de texte
9557 &image 2
9558 &Image par boîte de dialogue
9559 &Fichier par boîte de dialogue
9560 &Bouton input
9561 &Champ texte
9562 &Texte multi-ligne
9563 &ListBox
9564 &Liste déroulante
9565 &Submit
9566 &Reset
9508 +&Tableau
9591 &Insère un Tableau
9592 &Mois (insère un mois ; calendrier)
9593 &Couleur de fond de la cellule
9601 Couleur de fond de plusieurs cellules
9594 &Répète la dernière couleur de cellule
9595 &Insère une Ligne
9596 &Supprime la Ligne
9597 &Insère une Colonne
9598 &Supprime la Colonne
9599 &Fusionne avec la cellule suivante
9518 ----
9509 &Chercher
%GESTIONFICHIER%9518 ----
9513 &Voir avec le Navigateur par défaut
9518 ----
9515 +&Divers et Spécial
9701 &Copier source HTML de la sélection dans presse-papier
9702 Test
9520 &Notes
9518 ----
7777 &Répéter dernière commande
9518 ----
9519 &Quitter en enregistrant
9520 Abandonner (sans enregistrer)
"""
if the.fichier is None:
st=st.replace(u'%GESTIONFICHIER%',u"""9518 ----
9511 Ouvrir / Nouveau
9512 &Sauvegarder
""")
elif len(the.fichier)>64:
st=st.replace(u'%GESTIONFICHIER%',u"")
else:
st=st.replace(u'%GESTIONFICHIER%',u"""9518 ----
9512 &Sauvegarder
""")
w.createmenu(contextmenu=st)
w.graindesel(9505,undo, 9509,chercher, 9511,ouvrir, 9512,sauver, 9513, voirnavigateur, 9519,quitter, 9520,abandonner)
w.graindesel(9521,undo, 9522,redo, 9523,indente, 9524,desindente, 9525,ecrase, 9526,basculesource, 9527,supprimeformat, 9528,memorizeclipboard, 9529,pasteclipboard)
w.graindesel(9530,gras, 9531,souligne, 9532,italique, 9533,barre, 9534,exposant, 9535,indice)
w.graindesel(9541,agauche, 9542,acentre, 9543,adroite)
w.graindesel(9550,ilistnum, 9551,ilistbrut, 9552,iancre, 9553,ilien, 9554,ibouton,
9555,iligne, 9556,ibloctext, 9557,iimage2, 9558,setimage, 9559,ifichier, 9560,iinput,
9561,ichamptext, 9562,itextarea, 9563,ilistbox, 9564,ilistderoulante, 9565,isubmit,
9566,ireset)
w.graindesel(9610,fontarial, 9611,fonttimes, 9612,fontcomic, 9613,fontcourier, 9615,font1, 9616,font2, 9617,font3, 9618,font4, 9619,font5, 9620,font6, 9621,font7)
w.graindesel(9570,forecouleur, 9571,forerouge, 9572,forevert, 9573,forebleu, 9574,foreblanc, 9575,forenoir, 9576,foregris, 9577,forejaune, 9578,forerougef, 9579,forebleuf, 9580,forevertf)
w.graindesel(9581,backcouleur, 9582,backrouge, 9583,backrougef, 9584,backbleuf, 9585,backgrisf, 9586,backjaune, 9587,backnoir, 9588,backblanc)
w.graindesel(9701,copyhtmlclipboard, 9702,test)
w.graindesel(9591,itableau, 9592,imois, 9593,tcouleur, 9601, tcouleurmultiple, 9594,trepetecouleur, 9595,tinslig, 9596,tdellig, 9597,tinscol, 9598,tdelcol, 9599,tfusionnesuive)
w.graindesel(7777,repetercommande)
#w.graindeselkey(VK_F8=repetercommande)
if theconfig.pub:
ww.settop()
w.define(auto=None)
ww.settop()
for i in range(theconfig.pubdelai):
time.sleep(0.001) #0.750)
time.sleep(0.250) #0.750)
else:
w.define(auto=None)
iehandle=w.htmlmanaged(os.path.dirname(__file__)+"/the.htm", 0,30, w.l-8-8,w.h-margebasse, valideactivex=False, prepare=2)
###iehandle=w.htmlmanaged("file:///"+the.dirtravail+"/the.htm", 0,30, w.l-8-8,w.h-margebasse, valideactivex=False, prepare=2)
##iehandle=w.htmlmanaged("file:///"+os.path.dirname(__file__)+"/the.htm", 0,30, w.l-8-8,w.h-margebasse, valideactivex=False, prepare=2)
#iehandle=w.htmlmanaged(os.path.dirname(__file__)+"/the.htm", 0,30, w.l-8-8,w.h-margebasse, valideactivex=False, prepare=2)
#iehandle=w.htmlmanaged(None, 0,30, w.l-8-8,w.h-margebasse, valideactivex=False, prepare=2)
"""
OK 09:48
iehandle=w.htmlmanaged(None, 0,30, w.l-8-8,w.h-margebasse, valideactivex=False, prepare=2)
time.sleep(0.1)
iehandle=w.navig.navigUrl("file:///"+os.path.dirname(__file__)+"/the.htm")
time.sleep(0.1)
"""
#w.active()
thed=pywig.thediteur(w.navig,w.ffille,GuiLarg,GuiHaut)
if the.fichier is not None:
if os.path.isfile(the.fichier):
temp=open(the.fichier,"r").read()
try:
the.html=temp.decode('utf-8','replace')
except:
the.html=temp
elif len(the.fichier)>200 or the.fichier.find('<')>-1 or (the.fichier[:200].find('.htm')<0 and the.fichier[:200].find('.HTM')<0 and the.fichier[:50].find('\\'))<0:
the.html=the.fichier
else:
temp=open(the.fichier,"r").read()
try:
the.html=temp.decode('utf-8','replace')
except:
the.html=temp
thed.source(the.html)
thed.focus()
iex=w.x+win32api.GetSystemMetrics(win32con.SM_CXFRAME)+1
iey=w.y+win32api.GetSystemMetrics(win32con.SM_CYFRAME)+win32api.GetSystemMetrics(win32con.SM_CYCAPTION)+4+30-2
pywig.mouseclic(iex+2,iey+9)
if theconfig.pub:
ww.fermegauche()
clipboardtxt("AZERTY")
w.navig.trouvewindow()
w.run()
thed=None
if the.fichier is None:
try:
vret=the.html
except:
vret=""
return vret
else:
if len(the.fichier)>200 or the.fichier.find('<')>-1 or the.fichier[:100].find('.htm')<0 or the.fichier[:100].find('.HTM')<0 or the.fichier[:50].find('\\')<0:
return the.html
else:
return the.fichier
if __name__=='__main__':
if len(sys.argv)>1:
fic=sys.argv[1]
if fic.find("\\")>-1:
the(os.path.dirname(fic),fic) #os.path.basename(fic))
else:
the(os.getcwd(),os.join(os.getcwd(),sys.argv[1]))
else:
#the(None,"abc.htm")
the(None,None)
#h=open("abc.htm","r").read()
#print the(None,h)
#print "Fin."