Remove wineconfig module

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/12/head
Michele Calgaro 5 months ago
parent e8e077f5cb
commit 9953222e79
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 B

@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.0"
width="48"
height="48"
id="svg22509">
<defs
id="defs22511" />
<g
id="layer1">
<g
transform="matrix(6.614026e-2,0,0,6.614026e-2,23.57494,24.26456)"
id="g22526">
<g
transform="translate(-404.6182,-509.8812)"
id="g11924">
<path
d="M 320.28415,294.71524 C 302.12118,346.41597 286.86665,399.57092 275.875,454.85732 C 270.30071,487.60345 272.03416,523.04105 277.22073,555.78719 C 281.2387,581.8239 298.41872,594.69854 320.28414,602.8878 C 345.07806,607.86225 366.26816,598.42143 387.57073,589.43048 C 448.25458,531.68994 484.10672,449.1177 512.72377,359.31036 C 509.28389,343.4312 500.39902,328.12757 479.08048,322.9756 C 449.89862,321.13261 423.99325,325.84259 398.33658,331.05 C 370.14588,322.93282 344.92504,313.47535 320.28415,294.71524 z "
style="fill:#a60033;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="path9229" />
<path
d="M 372.76768,150.72195 C 436.92175,170.43677 497.91319,190.21936 558.47866,220.7 C 513.21157,358.93663 473.50299,559.90152 368.73048,604.23353 C 330.8273,613.39549 293.05338,597.80208 278.56646,567.89877 C 248.09144,482.84179 314.45201,283.09929 372.76768,150.72195 z "
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:15.4119997;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path1350" />
<path
d="M 321.62988,285.29512 C 342.43482,316.64859 374.03256,329.10119 409.10244,328.35854 C 489.13149,315.98935 517.35537,314.4253 515.41524,363.34756"
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:15.31200027;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path3100" />
<path
d="M 431.97989 806.09326 A 150.72195 26.914635 0 1 1 130.53598,806.09326 A 150.72195 26.914635 0 1 1 431.97989 806.09326 z"
transform="matrix(0.936355,0.351057,-0.351057,0.936355,265.8961,-43.39585)"
style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:15.31200027;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4850" />
<path
d="M 274.52926,562.51585 C 292.93894,584.84886 300.19467,727.34615 197.82256,767.06707 L 306.82683,814.16767 C 267.11729,731.62249 312.57755,609.41308 370.07621,605.57926 C 310.86206,610.96805 298.81425,595.97371 274.52926,562.51585 z "
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:14.21199989;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path5727" />
</g>
<path
d="M 114.83421,-123.65617 C 110.70662,-52.728825 231.18146,-55.493285 312.65677,-57.715315 C 294.69575,18.085265 283.11684,97.076905 223.83848,152.21882 C 148.92208,164.14898 41.634572,154.55539 7.1756821,88.969445 C 48.299602,49.878035 95.797142,-33.679755 114.83421,-123.65617 z "
style="fill:#40dd38;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path12847" />
<path
d="M 0.10128211,95.006635 C 37.691372,174.00836 155.82048,171.93536 218.45555,161.63894 C 178.96282,234.74806 140.46928,281.44214 81.190922,336.58406 C 6.2745221,348.51422 -67.369698,318.73465 -101.82859,253.1487 C -60.704668,214.05729 -18.935788,184.98304 0.10128211,95.006635 z "
style="fill:#f3ef2d;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path13722" />
<path
d="M -12.973098,102.38955 C -68.908908,132.16528 -134.37248,113.50025 -147.58347,39.906025 C -152.47753,-3.352935 -148.88358,-45.782585 -135.47188,-103.4702 L -134.61822,-109.51899 C -147.3714,-89.605505 -157.51337,-74.080805 -167.61822,-51.518985 L -236.61822,-52.518985 L -249.61822,-2.518985 L -184.61822,20.481015 C -186.0155,38.942245 -183.82539,52.228695 -182.61822,65.481015 L -234.61822,109.48101 L -207.61822,155.48101 L -149.61822,130.48101 C -137.14072,141.16268 -130.88217,146.99031 -117.61822,152.48101 L -124.61822,210.48101 L -83.618218,223.48101 C -55.108848,196.54981 -23.847578,153.13007 -12.973098,102.38955 z "
style="fill:#639de2;fill-opacity:1;fill-rule:evenodd;stroke:#1b63e6;stroke-width:6.11199999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path15517" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

@ -42,20 +42,17 @@ def doit():
executable_links = [('serviceconfig','serviceconfig.py'),
('userconfig','userconfig.py'),
('mountconfig','mountconfig.py'),
('wineconfig','wineconfig.py')],
('mountconfig','mountconfig.py')],
kcontrol_modules = [('serviceconfig/serviceconfig.desktop','serviceconfig.py'),
('userconfig/userconfig.desktop','userconfig.py'),
('mountconfig/mountconfig.desktop','mountconfig.py'),
('wineconfig/wineconfig.desktop','wineconfig.py')],
('mountconfig/mountconfig.desktop','mountconfig.py')],
data_files = [('share/icons/crystalsvg/16x16/apps',['kde/serviceconfig/pics/16x16/daemons.png',
'kde/mountconfig/pics/16x16/disksfilesystems.png',
'kde/userconfig/pics/16x16/userconfig.png',
'kde/wineconfig/pics/16x16/wineconfig.png'])],
'kde/userconfig/pics/16x16/userconfig.png'])],
i18n = ('po',['mountconfig','userconfig','serviceconfig','wineconfig']),
i18n = ('po',['mountconfig','userconfig','serviceconfig']),
application_data = [('pics',['kde/serviceconfig/pics/laserwarn.png',
'kde/serviceconfig/pics/hi32-app-daemons.png',
@ -88,9 +85,7 @@ def doit():
'kde/mountconfig/pics/file.png',
'kde/mountconfig/pics/important.png',
'kde/mountconfig/pics/tux.png',
'kde/mountconfig/pics/user.png',
'kde/wineconfig/pics/32-wine.png',
'kde/wineconfig/pics/kdewinewizard.png']),
'kde/mountconfig/pics/user.png']),
'serviceconfig/serviceconfig.py',
'userconfig/userconfig.py',
'userconfig/unixauthdb.py',
@ -100,10 +95,6 @@ def doit():
'mountconfig/SimpleCommandRunner.py',
'mountconfig/fuser.py',
'mountconfig/fuser_ui.ui',
'mountconfig/sizeview.py',
'wineconfig/wineconfig.py',
'wineconfig/wineread.py',
'wineconfig/winewrite.py',
'wineconfig/drivedetect.py'])
'mountconfig/sizeview.py'])
doit()

@ -1,122 +0,0 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
###########################################################################
# wineread.py - description #
# ------------------------------ #
# begin : Fri Mar 26 2004 #
# copyright : (C) 2006 by Yuriy Kozlov #
# email : yuriy.kozlov@gmail.com #
# #
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################
import os
import wineread
""" Reads a default set of drives from /etc/fstab """
fstabpath = "/etc/fstab"
# Listed in winecfg
ignored_fs_types = set(["devpts",
"tmpfs",
"proc",
"sysfs",
"swap",
"usbdevfs",
"rpc_pipefs",
"binfmt_misc"])
# Listed in winecfg
ignored_mnt_pts = set(["/boot"])
cd_fs_types = set(["cdfs","udf","iso9660"])
# An incomplete listing, I don't know how winecfg does this.
# RAMFS is included here because I don't know what the correct type for it is in wine.
hd_fs_types = set(["ext4","ext3","ext2","ext","fat","fat32","fat16","ntfs","reiserfs","reiser4",
"jfs","xfs","ramfs","vfat","ufs","hfs","hfsplus"])
# Listed in winecfg
net_fs_types = set(["nfs","nfs4","smbfs","cifs","coda"])
def autodetect(drives=None):
""" Returns a set of drives found by scanning /etc/fstab, and an error code """
if not drives:
drives = wineread.GetEmptyDrives()
mappings = set()
if not drives[2][2]:
drives[2][2] = "../drive_c"
drives[2][3] = "hd"
for drive in drives:
mapping = drive[2]
if mapping:
mappings.add(mapping)
driveid = 3
fstab=open(fstabpath,'r')
for driveline in fstab:
if driveline[0] == '#' or len(driveline.strip()) == 0: # Comment or empty line
continue
else:
driveprops = driveline.split()
fs = driveprops[0]
mnt = driveprops[1]
fstypes = set(driveprops[2].split(','))
ignore = False
for fstype in fstypes:
if fstype in ignored_fs_types:
ignore = True
break
if mnt in ignored_mnt_pts or mnt in mappings:
ignore = True
if not ignore:
while drives[driveid][2]: # Drive is in use, don't overwrite.
driveid += 1
if driveid > 25:
return (1,drives)
drives[driveid][2] = mnt
if "/dev/fd" in fs or "floppy" in mnt:
drives[driveid][3] = "floppy"
elif fstype in cd_fs_types or "/dev/cdrom" in fs or "cdrom" in mnt:
drives[driveid][3] = "cdrom"
elif fstype in hd_fs_types:
drives[driveid][3] = "hd"
elif fstype in net_fs_types:
drives[driveid][3] = "network"
else:
drives[driveid][3] = "auto"
driveid += 1
fstab.close()
return (0,drives)
def autodetectshelllinks(shelllinks = None):
""" Returns a default set of windows shell folder mappings """
if not shelllinks:
shelllinks = wineread.GetEmptyShellLinks()
for link in shelllinks:
if link[2]:
continue
else:
link[3] = "shellfolder"
#link[4] = wineread.winepath + "/dosdevices/c:/windows/profiles/" + os.environ['USER'] + "/" + link[1]
link[4] = wineread.defaultwinfolderspath + "\\" + link[1]
link[5] = wineread.defaultwinfolderspath + "\\" + link[1]
link[2] = os.environ['HOME']
if link[1] == "Desktop":
link[2] = os.environ['HOME'] + "/Desktop"
return shelllinks

@ -1,326 +0,0 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
###########################################################################
# wineconfig.py - description #
# ------------------------------ #
# begin : Fri Mar 26 2004 #
# copyright : (C) 2006 by Yuriy Kozlov #
# email : yuriy.kozlov@gmail.com #
# #
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################
from PyTQt.tqt import *
from tdecore import *
from tdeui import *
from tdefile import *
from tdeio import *
import os
import sys
import signal
import wineread
import winewrite
import drivedetect
class FirstRunWizard(KWizard):
default_winepath = os.environ['HOME'] + "/.wine"
def __init__(self, parent = None, name=None, modal=0, fl=0):
KWizard.__init__(self,parent,name,modal,fl)
if not name:
self.setName("firstrunwizard")
self.imagedir = str(TDEGlobal.dirs().findDirs("data","guidance/pics")[0])
self.setupPage1()
self.setupPageVersion()
self.setupPageExistingWine()
self.setupPageCreateWine()
self.slotCreateExistingToggled(0)
#self.connect(self,SIGNAL("selected(const TQString &)"),self.slotPageChanged)
#self.resize(TQSize(600,480).expandedTo(self.minimumSizeHint()))
self.clearWState(TQt.WState_Polished)
def setupPage1(self):
page1 = TQHBox(self,"page1")
self.kdewinepicture = TQLabel(page1,"kdewinepicture")
self.kdewinepicture.setSizePolicy(TQSizePolicy(TQSizePolicy.Fixed,TQSizePolicy.Fixed,0,0,self.kdewinepicture.sizePolicy().hasHeightForWidth()))
self.kdewinepicture.setMinimumSize(TQSize(140,320))
self.kdewinepicture.setPixmap(TQPixmap(self.imagedir+"kdewinewizard.png"))
#self.kdewinepicture.setScaledContents(1)
spacer = TQWidget(page1)
spacer.setMinimumSize(TQSize(6,300))
pagebody = TQVBox(page1,"pagebody")
page1.setStretchFactor(pagebody,1)
introtext = TQLabel(pagebody,"introtext")
introtext.setText(i18n("It appears that you do not yet have a Windows drive set up.\n" +\
"This wizard will help set it up so that you can run windows applications.\n"))
spacer = TQWidget(pagebody)
spacer.setMinimumSize(TQSize(6,20))
self.createinstall = True
createwinepathchoice = TQRadioButton(i18n("Set up the fake windows installation " +\
"in the following directory:"),pagebody)
self.winepath = self.default_winepath
hbox = TQHBox(pagebody)
hbox.setSpacing(KDialog.spacingHint())
self.winefolderedit = KLineEdit(self.winepath,hbox)
self.urlcompletion = KURLCompletion(KURLCompletion.DirCompletion)
self.winefolderedit.setCompletionObject(self.urlcompletion)
self.winefolderedit.setCompletionMode(TDEGlobalSettings.CompletionPopup)
self.connect(self.winefolderedit,SIGNAL("textChanged(const TQString &)"),self.slotWineFolderEdited)
self.browsecreatebutton = KPushButton(i18n("Browse"),hbox)
self.connect(self.browsecreatebutton,SIGNAL("clicked()"),self.slotBrowseClicked)
spacer = TQWidget(pagebody)
spacer.setMinimumSize(TQSize(6,10))
existingwinepathchoice = TQRadioButton(i18n("There is already a fake windows installation " +\
"in the following directory:"),pagebody)
hbox = TQHBox(pagebody)
hbox.setSpacing(KDialog.spacingHint())
self.existingwinefolderedit = KLineEdit("",hbox)
self.urlcompletion = KURLCompletion(KURLCompletion.DirCompletion)
self.existingwinefolderedit.setCompletionObject(self.urlcompletion)
self.existingwinefolderedit.setCompletionMode(TDEGlobalSettings.CompletionPopup)
self.connect(self.existingwinefolderedit,SIGNAL("textChanged(const TQString &)"),self.slotWineFolderEdited)
self.browseexistingbutton = KPushButton(i18n("Browse"),hbox)
self.connect(self.browseexistingbutton,SIGNAL("clicked()"),self.slotBrowseClicked)
self.createexistingchoicesgroup = TQButtonGroup(pagebody,"createexistingchoicesgroup")
self.createexistingchoicesgroup.insert(createwinepathchoice,0)
self.createexistingchoicesgroup.insert(existingwinepathchoice,1)
self.createexistingchoicesgroup.setExclusive(True)
self.createexistingchoicesgroup.hide()
self.createexistingchoicesgroup.setButton(0)
self.connect(self.createexistingchoicesgroup,SIGNAL("clicked(int)"),self.slotCreateExistingToggled)
bottomspacer = TQWidget(pagebody)
pagebody.setStretchFactor(bottomspacer,1)
self.addPage( page1, i18n("Setting up your windows drive") )
self.setBackEnabled( page1, False )
self.setNextEnabled( page1, True )
self.setHelpEnabled( page1, False )
self.setFinishEnabled( page1, False )
def setupPageExistingWine(self):
self.pageexisting = TQHBox(self,"pageexisting")
self.kdewinepicture = TQLabel(self.pageexisting,"kdewinepicture")
self.kdewinepicture.setSizePolicy(TQSizePolicy(TQSizePolicy.Fixed,TQSizePolicy.Fixed,0,0,self.kdewinepicture.sizePolicy().hasHeightForWidth()))
self.kdewinepicture.setMinimumSize(TQSize(140,320))
self.kdewinepicture.setPixmap(TQPixmap(self.imagedir+"kdewinewizard.png"))
#self.kdewinepicture.setScaledContents(1)
spacer = TQWidget(self.pageexisting)
spacer.setMinimumSize(TQSize(6,300))
valid = wineread.VerifyWineDrive(self.winepath)
pagebody = TQVBox(self.pageexisting,"pagebody")
self.pageexisting.setStretchFactor(pagebody,1)
existstext = TQLabel(pagebody,"existstext")
if valid:
existstext.setText(i18n("A fake windows installation was found."))
else:
existstext.setText(i18n("No fake windows installation was found in\n" +\
self.winepath + "\nPlease go back and create one."))
bottomspacer = TQWidget(pagebody)
pagebody.setStretchFactor(bottomspacer,1)
self.addPage( self.pageexisting, i18n("Setting up your windows drive") )
self.setBackEnabled( self.pageexisting, True )
self.setNextEnabled( self.pageexisting, True )
self.setHelpEnabled( self.pageexisting, False )
self.setFinishEnabled( self.pageexisting, True )
def setupPageCreateWine(self):
self.pagecreate = TQHBox(self,"pagecreate")
self.kdewinepicture = TQLabel(self.pagecreate,"kdewinepicture")
self.kdewinepicture.setSizePolicy(TQSizePolicy(TQSizePolicy.Fixed,TQSizePolicy.Fixed,0,0,self.kdewinepicture.sizePolicy().hasHeightForWidth()))
self.kdewinepicture.setMinimumSize(TQSize(140,320))
self.kdewinepicture.setPixmap(TQPixmap(self.imagedir+"kdewinewizard.png"))
#self.kdewinepicture.setScaledContents(1)
spacer = TQWidget(self.pagecreate)
spacer.setMinimumSize(TQSize(6,300))
pagebody = TQVBox(self.pagecreate,"pagebody")
self.pagecreate.setStretchFactor(pagebody,1)
self.createdtext = TQLabel(pagebody,"existstext")
self.createdtext.setText(i18n("A fake windows installation was created for you in\n" +\
self.winepath))
bottomspacer = TQWidget(pagebody)
pagebody.setStretchFactor(bottomspacer,1)
self.addPage( self.pagecreate, i18n("Setting up your windows drive") )
self.setBackEnabled( self.pagecreate, False )
self.setNextEnabled( self.pagecreate, True )
self.setHelpEnabled( self.pagecreate, False )
self.setFinishEnabled( self.pagecreate, True )
def setupPageVersion(self):
self.pageversion = TQHBox(self,"pageversion")
self.kdewinepicture = TQLabel(self.pageversion,"kdewinepicture")
self.kdewinepicture.setSizePolicy(TQSizePolicy(TQSizePolicy.Fixed,TQSizePolicy.Fixed,0,0,self.kdewinepicture.sizePolicy().hasHeightForWidth()))
self.kdewinepicture.setMinimumSize(TQSize(140,320))
self.kdewinepicture.setPixmap(TQPixmap(self.imagedir+"kdewinewizard.png"))
#self.kdewinepicture.setScaledContents(1)
spacer = TQWidget(self.pageversion)
spacer.setMinimumSize(TQSize(6,300))
pagebody = TQVBox(self.pageversion,"pagebody")
self.pageversion.setStretchFactor(pagebody,1)
versiontext = TQLabel(pagebody,"versiontext")
versiontext.setText(i18n("What windows version would you like to emulate?\n"))
self.winversions = wineread.winversions
self.verid=1
self.versioncombo = KComboBox(0,pagebody,"versioncombo")
self.fillVersionCombo(self.versioncombo)
self.connect(self.versioncombo,SIGNAL("activated(int)"),self.slotVersionActivated)
self.__selectWinVer(self.verid)
bottomspacer = TQWidget(pagebody)
pagebody.setStretchFactor(bottomspacer,1)
self.addPage( self.pageversion, i18n("Setting up your windows drive") )
self.setBackEnabled( self.pageversion, True )
self.setNextEnabled( self.pageversion, True )
self.setHelpEnabled( self.pageversion, False )
self.setFinishEnabled( self.pageversion, False )
def fillVersionCombo(self,combo):
""" Fill the combobox with the values from our list """
for version in self.winversions:
combo.insertItem(version[1])
def __selectWinVer(self,verid):
"""
Sets the current windows version and selects it in the combo box
"""
self.versioncombo.setCurrentItem(verid)
def slotVersionActivated(self,verid):
self.verid = verid
def slotFolderChanged(self,folder):
""" Change the directory when a new one is entered in the URL box """
self.winepath = str(folder)
def slotWineFolderEdited(self,folder):
""" Change the directory when a new one is entered manually in the URL box """
self.urlcompletion.makeCompletion("") # Doesn't seem like this should be required.
self.slotFolderChanged(folder)
def slotBrowseClicked(self):
""" Bring up a browse window to choose a directory """
path = KFileDialog.getExistingDirectory(wineread.winepath,self,i18n("Windows Directory"))
if path:
self.winepath = str(path)
#def slotPageChanged(self,pagename):
# if pagename == "pagecreate":
# self.CreateWindowsInstall()
def slotCreateExistingToggled(self, buttonid):
""" Called when the choice to create a new windows drive or use an existing one is changed """
if buttonid == 0:
self.createinstall = True
self.winefolderedit.setEnabled(True)
self.browsecreatebutton.setEnabled(True)
self.existingwinefolderedit.setEnabled(False)
self.browseexistingbutton.setEnabled(False)
self.setAppropriate(self.pageversion,True)
self.setAppropriate(self.pageexisting,False)
self.setAppropriate(self.pagecreate,True)
elif buttonid == 1:
self.createinstall = False
self.winefolderedit.setEnabled(False)
self.browsecreatebutton.setEnabled(False)
self.existingwinefolderedit.setEnabled(True)
self.browseexistingbutton.setEnabled(True)
self.setAppropriate(self.pageversion,False)
self.setAppropriate(self.pageexisting,True)
self.setAppropriate(self.pagecreate,False)
def showPage(self,page):
if page == self.pagecreate:
self.CreateWindowsInstall()
KWizard.showPage(self,page)
def CreateWindowsInstall(self):
winewrite.CreateWineDrive(self.winepath)
wineread.SetWinePath(self.winepath)
autodrives = drivedetect.autodetect()
autoshelllinks = drivedetect.autodetectshelllinks()
if autodrives[0] == 1:
KMessageBox.sorry(self, \
i18n("There were not enough letters to add all the autodetected drives."))
drives = autodrives[1]
drives[26:] = autoshelllinks
winewrite.SetDriveMappings(drives)
winewrite.SetAudioDriver('alsa')
dsoundsettings = {"HardwareAcceleration":"Full",
"DefaultSampleRate":"44100",
"DefaultBitsPerSample":"8",
"EmulDriver":"N"}
winewrite.SetDSoundSettings(dsoundsettings)
windowsettings = {"DXGrab":"N",
"DesktopDoubleBuffered":"Y",
"Managed":"Y",
"Desktop":""}
winewrite.SetWindowSettings(windowsettings)
d3dsettings = {"VertexShaderMode":"hardware",
"PixelShaderMode":"Y"}
winewrite.SetD3DSettings(d3dsettings)
winewrite.SetWinVersion(self.winversions[self.verid])
self.createdtext.setText(i18n("A fake windows installation was created for you in\n" +\
self.winepath))

@ -1,144 +0,0 @@
/*
* pykcm_launcher.cpp
*
* Launch Control Centre modules written in Python using an embedded Python
* interpreter.
* Based on David Boddie's PyTDE-components.
*/
// pythonize.h must be included first.
#include <pythonize.h>
#include <tdecmodule.h>
#include <tdeglobal.h>
#include <tdelocale.h>
#include <klibloader.h>
#include <kstandarddirs.h>
#include <ksimpleconfig.h>
#include <tqstring.h>
#include <sip-tqt.h>
#define MODULE_DIR "/root/TEMP5/tde-guidance-trinity-14.0.0-r131/debian/tmp/opt/trinity/share/apps/guidance"
#define EXTRA_MODULE_DIR "None"
#define MODULE_NAME "wineconfig"
#define FACTORY "create_wineconfig"
#define CPP_FACTORY create_wineconfig
#define LIB_PYTHON "libpython2.7.so"
#define debug 1
static TDECModule *report_error(char *msg) {
if (debug) printf ("error: %s\n", msg);
return NULL;
}
static TDECModule* return_instance( TQWidget *parent, const char *name ) {
TDECModule* tdecmodule;
PyObject *pyTDECModuleTuple;
PyObject *pyTDECModule;
Pythonize *pyize; // Pythonize object to manage the Python interpreter.
int isErr;
// Try to determine what py script we're loading. Note that "name"
// typically appears to be NULL.
TQString script(MODULE_NAME);
// Reload libpython, but this time tell the runtime linker to make the
// symbols global and available for later loaded libraries/module.
KLibLoader::self()->globalLibrary(LIB_PYTHON);
// Start the interpreter.
pyize = initialize();
if (!pyize) {
return report_error ("***Failed to start interpreter\n");
}
// Add the path to the python script to the interpreter search path.
TQString path = TQString(MODULE_DIR);
if(path == TQString::null) {
return report_error ("***Failed to locate script path");
}
if(!pyize->appendToSysPath (path.latin1 ())) {
return report_error ("***Failed to set sys.path\n");
}
// Add the extra path to the python script to the interpreter search path.
TQString extrapath = TQString(EXTRA_MODULE_DIR);
if(!pyize->appendToSysPath (extrapath.latin1 ())) {
return report_error ("***Failed to set extra sys.path\n");
}
// Load the Python script.
PyObject *pyModule = pyize->importModule ((char *)script.latin1 ());
if(!pyModule) {
PyErr_Print();
return report_error ("***failed to import module\n");
}
// Inject a helper function
TQString bridge = TQString("import sip_tqt\n"
"from PyTQt import tqt\n"
"def kcontrol_bridge_" FACTORY "(parent,name):\n"
" if parent!=0:\n"
" wparent = sip_tqt.wrapinstance(parent,tqt.TQWidget)\n"
" else:\n"
" wparent = None\n"
" inst = " FACTORY "(wparent, name)\n"
" return (inst,sip_tqt.unwrapinstance(inst))\n");
PyRun_String(bridge.latin1(),Py_file_input,PyModule_GetDict(pyModule),PyModule_GetDict(pyModule));
// Get the Python module's factory function.
PyObject *kcmFactory = pyize->getNewObjectRef(pyModule, "kcontrol_bridge_" FACTORY);
if(!kcmFactory) {
return report_error ("***failed to find module factory\n");
}
// Call the factory function. Set up the args.
PyObject *pyParent = PyLong_FromVoidPtr(parent);
PyObject *pyName = PyBytes_FromString(MODULE_NAME);
// Using NN here is effect gives our references to the arguement away.
PyObject *args = Py_BuildValue ("NN", pyParent, pyName);
if(pyName && pyParent && args) {
// run the factory function
pyTDECModuleTuple = pyize->runFunction(kcmFactory, args);
if(!pyTDECModuleTuple) {
PyErr_Print();
return report_error ("*** runFunction failure\n;");
}
} else {
return report_error ("***failed to create args\n");
}
// cleanup a bit
pyize->decref(args);
pyize->decref(kcmFactory);
// Stop this from getting garbage collected.
Py_INCREF(PyTuple_GET_ITEM(pyTDECModuleTuple,0));
// convert the TDECModule PyObject to a real C++ TDECModule *.
isErr = 0;
pyTDECModule = PyTuple_GET_ITEM(pyTDECModuleTuple,1);
tdecmodule = (TDECModule *)PyLong_AsVoidPtr(pyTDECModule);
if(!tdecmodule) {
return report_error ("***failed sip conversion to C++ pointer\n");
}
pyize->decref(pyTDECModuleTuple);
// PyTDE can't run the module without this - Pythonize
// grabs the lock at initialization and we have to give
// it back before exiting. At this point, we no longer need
// it.
//pyize->releaseLock ();
// take care of any translation info
TDEGlobal::locale()->insertCatalogue(script);
// Return the pointer to our new TDECModule
return tdecmodule;
}
extern "C" {
// Factory function that kcontrol will call.
TDECModule* CPP_FACTORY(TQWidget *parent, const char *name) {
return return_instance(parent, name);
}
}

@ -1,57 +0,0 @@
[Desktop Entry]
Categories=Qt;TDE;X-TDE-settings-system;X-TDE-systemsettings-advancedadministration;
Comment=Wine Configuration
Comment[el]=Ρυθμίσεις του Wine
Comment[es]=Configuración de wine
Comment[et]=Wine seadistamine
Comment[it]=Configurazione di Wine
Comment[ja]=Wine の設定
Comment[nl]=Wine instellen
Comment[pt]=Configuração do Wine
Comment[pt_BR]=Configuração do Wine
Comment[sr]=Wine подешавања
Comment[sr@Latn]=Wine podešavanja
Comment[sv]=Inställning av Wine
Comment[xx]=xxWine Configurationxx
Encoding=UTF-8
Exec=tdecmshell System/wineconfig
GenericName=Wine Configuration Editor
GenericName[el]=Επεξεργαστής ρυθμίσεων του Wine
GenericName[es]=Editor de la configuración de wine
GenericName[et]=Wine seadistuste redaktor
GenericName[it]=Editor della configurazione di Wine
GenericName[ja]=Wine 設定エディタ
GenericName[nl]=Wine-configuratiemodule
GenericName[pt]=Editor de Configuração do Wine
GenericName[pt_BR]=Editor de Configurações do Wine
GenericName[sr]=Уређивач Wine подешавања
GenericName[sr@Latn]=Uređivač Wine podešavanja
GenericName[sv]=Editor för inställning av Wine
GenericName[xx]=xxWine Configuration Editorxx
Icon=wineconfig
MimeType=
Name=Windows Applications
Name[el]=Εφαρμογές Windows
Name[es]=Aplicaciones de Windows
Name[et]=Windowsi rakendused
Name[it]=Applicazioni Windows
Name[ja]=Windows アプリケーション
Name[nl]=Windows-programma's
Name[pt]=Aplicações do Windows
Name[pt_BR]=Aplicativos Windows
Name[sr]=Windows програми
Name[sr@Latn]=Windows programi
Name[sv]=Windows-program
Name[xx]=xxWindows Applicationsxx
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DCOP-ServiceType=
X-TDE-FactoryName=wineconfig
X-TDE-Library=wineconfig
X-TDE-ModuleType=Library
X-TDE-RootOnly=false
X-TDE-SubstituteUID=false
X-TDE-Username=

File diff suppressed because it is too large Load Diff

@ -1,545 +0,0 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
###########################################################################
# wineread.py - description #
# ------------------------------ #
# begin : Fri Mar 26 2004 #
# copyright : (C) 2006 by Yuriy Kozlov #
# email : yuriy.kozlov@gmail.com #
# #
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################
import os
""" Provides a set of functions for accessing wine's settings """
# Assumes the fake windows is installed in ~/.wine
default_winepath = os.environ['HOME'] + "/.wine"
winepath = default_winepath
defaultwinfolderspath = "c:\\users\\" + os.environ['USER']
# Where the dll's are
default_winebuildpath = "/usr/lib/wine"
default_winebuildpath2 = "/usr/lib32/wine"
default_winebuildpath3 = "/usr/local/lib/wine"
winebuildpath = None
def GetWineBuildPath():
""" Returns the wine build path, None if not present """
path = None
if winebuildpath:
path = winebuildpath
elif os.path.exists(default_winebuildpath):
path = default_winebuildpath
elif os.path.exists(default_winebuildpath2):
path = default_winebuildpath2
elif os.path.exists(default_winebuildpath3):
path = default_winebuildpath3
return path
def SetWineBuildPath(path):
""" Sets the winebuildpath to path """
global winebuildpath
winebuildpath = path
# drive = [index, letter, unixpath/mapping, type, label, serial]
empty_drives = (
[0,"A:","","","",""],
[1,"B:","","","",""],
[2,"C:","","","",""],
[3,"D:","","","",""],
[4,"E:","","","",""],
[5,"F:","","","",""],
[6,"G:","","","",""],
[7,"H:","","","",""],
[8,"I:","","","",""],
[9,"J:","","","",""],
[10,"K:","","","",""],
[11,"L:","","","",""],
[12,"M:","","","",""],
[13,"N:","","","",""],
[14,"O:","","","",""],
[15,"P:","","","",""],
[16,"Q:","","","",""],
[17,"R:","","","",""],
[18,"S:","","","",""],
[19,"T:","","","",""],
[20,"U:","","","",""],
[21,"V:","","","",""],
[22,"W:","","","",""],
[23,"X:","","","",""],
[24,"Y:","","","",""],
[25,"Z:","","","",""])
def GetEmptyDrives():
""" Returns a list of 26 empty drives """
drives = []
for drive in empty_drives:
drives.append(drive[:])
return drives
def LoadDrives():
drives = GetEmptyDrives()
driveletters = os.listdir(winepath + "/dosdevices")
for folder in driveletters:
if len(folder) > 2 or folder[1] != ':':
del folder
set(driveletters)
drivetypes = GetDriveTypes()
for drive in drives:
letter = drive[1].lower()
if letter in driveletters:
drive[2] = os.readlink(winepath + "/dosdevices/" + letter)
if drive[1] in drivetypes:
drive[3] = drivetypes[drive[1]]
return drives
empty_shelllinks = ([26,"Desktop","","","",""],
[27,"My Documents","","","",""],
[28,"My Pictures","","","",""],
[29,"My Music","","","",""],
[30,"My Video","","","",""])
folder_nonexistent = "This folder does not exist, please map it."
profilesdirectory = winepath + "/dosdevices/c:/users/" + os.environ['USER']
def GetEmptyShellLinks():
""" Returns a list of important windows folders """
shelllinks = []
for link in empty_shelllinks:
shelllinks.append(link[:])
return shelllinks
def GetShellLinks():
shelllinks = GetEmptyShellLinks()
existingshelllinks = os.listdir(profilesdirectory)
set(existingshelllinks)
shellregistry = GetShellRegistry()
usershellregistry = GetUserShellRegistry()
for link in shelllinks:
if link[1] in existingshelllinks:
linkpath = profilesdirectory + "/" + link[1]
if os.path.islink(linkpath):
link[2] = os.readlink(linkpath)
else:
link[2] = linkpath
link[3] = "shellfolder"
winpath = defaultwinfolderspath + "\\" + link[1]
link[4] = winpath
link[5] = shellregistry.get(link[1], defaultwinfolderspath + "\\" + link[1])
link[5] = link[5].replace("\\\\","\\")
else:
link[3] = "shellfolder"
link[4] = folder_nonexistent
link[5] = shellregistry.get(link[1], folder_nonexistent)
link[5] = link[5].replace("\\\\","\\")
return shelllinks
def GetValue(key, value):
""" Returns a specific value, returns a blank string if the value is not there. """
# Need 4 \'s to generate one because both python and the shell use it as an escape character
key = key.replace("\\","\\\\")
key = key.replace(" ","\\ ")
error = os.system("wine regedit /E .registryvalue.reg " + key)
if error != 0:
return ""
file=open('.registryvalue.reg', encoding='utf-16', mode='r')
for line in file:
if line and line[0] == '"' or line[0] == '@':
line = line.strip('\r\n')
line = line.split('=')
line = (line[0].strip('"'),line[1].strip('"@'))
if line[0] == value:
file.close()
os.remove(".registryvalue.reg")
return line[1]
else:
file.close()
os.remove(".registryvalue.reg")
return ""
def GetKeyValues(key):
""" Returns a dictionary of all the values in the key
Returns an empty dictionary if the key does not exist
Does not read subkeys within the key """
# Need 4 \'s to generate one because both python and the shell use it as an escape character
key = key.replace("\\","\\\\")
key = key.replace(" ","\\ ")
error = os.system("wine regedit /E .registrykey.reg " + key)
if error != 0:
return {}
settings = {}
file=open('.registrykey.reg', encoding='utf-16', mode='r')
keycount = 0
for line in file:
if keycount > 1:
break
elif line and line[0] == '[':
keycount += 1
elif line and line[0] == '"':
line = line.split('=')
settings[line[0].strip('"')] = line[1].strip('"\r\n@')
file.close()
os.remove(".registrykey.reg")
return settings
def GetUserShellRegistry():
error = os.system("wine regedit /E .registryshelluser.reg HKEY_USERS\\\\.Default\\\\Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\User\\ Shell\\ Folders")
if error != 0:
return {}
usershellfile=open('.registryshelluser.reg', encoding='utf-16', mode='r')
usershellfilelines = usershellfile.readlines()
usershellfile.close()
os.remove(".registryshelluser.reg")
settings = {}
del(usershellfilelines[:3])
for usershellline in usershellfilelines:
usershellline = usershellline.split('=')
if len(usershellline) == 2:
settings[usershellline[0].strip('"')] = usershellline[1].strip('"\r\n')
return settings
def GetShellRegistry():
error = os.system("wine regedit /E .registryshell.reg HKEY_USERS\\\\.Default\\\\Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Shell\\ Folders")
if error != 0:
return {}
shellfile=open('.registryshell.reg', encoding='utf-16', mode='r')
shellfilelines = shellfile.readlines()
shellfile.close()
os.remove(".registryshell.reg")
settings = {}
del(shellfilelines[:3])
for shellline in shellfilelines:
shellline = shellline.split('=')
if len(shellline) == 2:
settings[shellline[0].strip('"')] = shellline[1].strip('"\r\n')
return settings
def GetDriveTypes():
""" Returns a dictionary of the drive types """
# Drive C: doesn't get stored in the registry
defaulttypes = {"C:":"hd"}
types = GetKeyValues("HKEY_LOCAL_MACHINE\\Software\\Wine\\Drives")
types.update(defaulttypes)
return types
def GetAudioDriver():
""" Returns the audio driver currently set in the registry """
return GetValue("HKEY_CURRENT_USER\\Software\\Wine\\Drivers","Audio")
def GetDSoundSettings(app = None):
""" Returns a dictionary of the settings for the DirectSound section """
if not app:
return GetKeyValues("HKEY_CURRENT_USER\\Software\\Wine\\DirectSound")
else:
return GetKeyValues("HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\" +\
app + "\\DirectSound")
def GetWindowSettings(app = None):
""" Returns a dictionary of the Window Settings """
if not app:
return GetKeyValues("HKEY_CURRENT_USER\\Software\\Wine\\X11 Driver")
else:
return GetKeyValues("HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\" +\
app + "\\X11 Driver")
def GetD3DSettings(app = None):
""" Returns a dictionary of the Direct3D Settings """
if not app:
return GetKeyValues("HKEY_CURRENT_USER\\Software\\Wine\\Direct3D")
else:
return GetKeyValues("HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\" +\
app + "\\Direct3D")
# Copied from winecfg
winversions = (
( "win2003", "Windows 2003", 5, 2, 0xECE, "VER_PLATFORM_WIN32_NT", "Service Pack 1", 1, 0, "ServerNT"),
( "winxp", "Windows XP", 5, 1, 0xA28, "VER_PLATFORM_WIN32_NT", "Service Pack 2", 2, 0, "WinNT"),
( "win2k", "Windows 2000", 5, 0, 0x893, "VER_PLATFORM_WIN32_NT", "Service Pack 4", 4, 0, "WinNT"),
( "winme", "Windows ME", 4, 90, 0xBB8, "VER_PLATFORM_WIN32_WINDOWS", " ", 0, 0, ""),
( "win98", "Windows 98", 4, 10, 0x8AE, "VER_PLATFORM_WIN32_WINDOWS", " A ", 0, 0, ""),
( "win95", "Windows 95", 4, 0, 0x3B6, "VER_PLATFORM_WIN32_WINDOWS", "", 0, 0, ""),
( "nt40", "Windows NT 4.0", 4, 0, 0x565, "VER_PLATFORM_WIN32_NT", "Service Pack 6a", 6, 0, "WinNT"),
( "nt351", "Windows NT 3.5", 3, 51, 0x421, "VER_PLATFORM_WIN32_NT", "Service Pack 2", 0, 0, "WinNT"),
( "win31", "Windows 3.1", 2, 10, 0, "VER_PLATFORM_WIN32s", "Win32s 1.3", 0, 0, ""),
( "win30", "Windows 3.0", 3, 0, 0, "VER_PLATFORM_WIN32s", "Win32s 1.3", 0, 0, ""),
( "win20", "Windows 2.0", 2, 0, 0, "VER_PLATFORM_WIN32s", "Win32s 1.3", 0, 0, ""))
def GetGeneralWineSettings(app = None):
""" Returns a dictionary of the general wine Settings, including the windows version """
if not app:
return GetKeyValues("HKEY_CURRENT_USER\\Software\\Wine")
else:
return GetKeyValues("HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\" +\
app)
def GetApps():
"""
Returns a list of the applications which have keys for application
specific settings.
"""
error = os.system("wine regedit /E .registryapps.reg HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\AppDefaults")
if error != 0:
return []
settingsfile=open('.registryapps.reg', encoding='utf-16', mode='r')
settingsfilelines = settingsfile.readlines()
settingsfile.close()
os.remove('.registryapps.reg')
apps = set([])
del(settingsfilelines[:3])
for line in settingsfilelines:
if line[0] == '[':
line = line.split('\\')
line[4] = line[4].strip(']\r\n')
apps.add(line[4])
apps = list(apps)
apps.sort()
return apps
builtin_only = set(("advapi32",
"capi2032",
"dbghelp",
"ddraw",
"gdi32",
"glu32",
"icmp",
"iphlpapi",
"joystick.drv",
"kernel32",
"mswsock",
"ntdll",
"opengl32",
"stdole2.tlb",
"stdole32.tlb",
"twain_32",
"unicows",
"user32",
"vdmdbg",
"w32skrnl",
"winealsa.drv",
"winearts.drv",
"wineaudioio.drv",
"wined3d",
"winedos",
"wineesd.drv",
"winejack.drv",
"winemp3.acm",
"winenas.drv",
"wineoss.drv",
"wineps",
"wineps.drv",
"winex11.drv",
"winmm",
"wintab32",
"wnaspi32",
"wow32",
"ws2_32",
"wsock32"))
def GetDllsList():
""" Returns a list of dlls that can be overridden """
origdlls = os.listdir(GetWineBuildPath())
dlls = [""]
for dll in origdlls:
dll = dll.rstrip('.so')
dots = dll.count('.')
if dots != 1:
continue
dll, extension = dll.split('.')
if not (extension != "dll" or dll in builtin_only):
dlls.append(dll)
dlls.sort()
return dlls
def GetDllOverrides(app = None):
""" Returns a dictionary of overridden dlls """
if not app:
return GetKeyValues("HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides")
else:
return GetKeyValues("HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\" +\
app + "\\DllOverrides")
# --- Getting and Setting the Default browser ---
# WineBrowser>Browsers
# List of browsers that Wine will attempt to launch when running winebrowser
# command or clicking on a link in a windows application. Default value is
default_browserlist = ["firefox","konqueror","mozilla","netscape","galeon","opera","dillo"]
# WineBrowser>Mailers
# List of mail clients that Wine will attempt to launch when running winebrowser
# Default value is
default_mailerlist = ["mozilla-thunderbird","thunderbird","evolution","kmail"]
#with firefox installed
browser_formats = ["CHROME","FirefoxHTML","HTML","htmlfile","FTP","GOPHER","http","https"]
default_browser_formats = ["htmlfile","http","https"] # just "winebrowser"
default_mailer_formats = ["mailto"] # "winebrowser %1"
def GetBrowser():
""" Returns the default browser """
browser = GetValue("HKEY_LOCAL_MACHINE\\Software\\Classes\\http\\shell\\open\\command",'@')
if browser == "winebrowser":
return GetWineBrowser()
else:
return browser
def GetWineBrowser():
""" Returns the first browser tried by winebrowser """
browserlist = GetValue("HKEY_CURRENT_USER\\Software\\Wine\\WineBrowser","Browsers")
if browserlist:
browser = browserlist.split(',')[0].strip()
return browser
else:
return default_browserlist[0]
#def GetWinBrowserList():
def GetNativeBrowserList():
""" Returns the list of browsers tried by winebrowser """
browserlist = GetValue("HKEY_CURRENT_USER\\Software\\Wine\\WineBrowser","Browsers")
if browserlist:
browserlist = list(set(browserlist.split(',')))
for i,item in enumerate(browserlist):
browserlist[i] = item.strip()
return browserlist
else:
return default_browserlist
def GetMailer():
""" Returns the default mail client """
mailer = GetValue("HKEY_LOCAL_MACHINE\\Software\\Classes\\mailto\\shell\\open\\command",'@')
if mailer == "winebrowser" or mailer == "winebrowser %1":
return GetWineMailer()
else:
return mailer
def GetWineMailer():
""" Returns the first mail client tried by winebrowser """
mailerlist = GetValue("HKEY_CURRENT_USER\\Software\\Wine\\WineBrowser","Mailers")
if mailerlist:
mailer = mailerlist.split(',')[0].strip()
return mailer
else:
# Default first mailer to try in wine is mozilla-thunderbird
return default_mailerlist[0]
def GetNativeMailerList():
""" Returns the list of mail clients tried by winebrowser """
mailerlist = GetValue("HKEY_CURRENT_USER\\Software\\Wine\\WineBrowser","Mailers")
if mailerlist:
mailerlist = list(set(mailerlist.split(',')))
for i,item in enumerate(mailerlist):
mailerlist[i] = item.strip()
return mailerlist
else:
return default_mailerlist
# ----- Theming -----
def GetThemesList():
""" Returns a list of installed thiemes """
if not os.path.exists(winepath + "/dosdevices/c:/windows/Resources/Themes"):
return []
origthemes = os.listdir(winepath + "/dosdevices/c:/windows/Resources/Themes")
themes = []
for i,theme in enumerate(origthemes):
if os.path.exists(winepath +\
"/dosdevices/c:/windows/Resources/Themes/" + theme +\
"/" + theme + ".msstyles"):
themes.append(theme)
themes.sort()
return themes
def GetCurrentTheme():
""" Returns the current (theme,color,size), None if none is set """
themeinfo = GetKeyValues("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\ThemeManager")
if not themeinfo or themeinfo["ThemeActive"] == "0":
return None
else:
# themename from themename.msstyles
themename = themeinfo["DllName"].split('\\\\')[-1].split('.')[0]
theme = (themename, themeinfo["ColorName"], themeinfo["SizeName"])
return theme
def GetColorSettings():
""" Returns a dictionary of the set colors """
return GetKeyValues("HKEY_CURRENT_USER\\Control Panel\\Colors")
def GetWindowMetrics():
""" Returns a dictionary of the WindowMetrics settings """
return GetKeyValues("HKEY_CURRENT_USER\\Control Panel\\Desktop\\WindowMetrics")
def GetDesktopSettings():
""" Returns a dictionary of the control panel \ Desktop settings """
return GetKeyValues("HKEY_CURRENT_USER\\Control Panel\\Desktop")
def SetWinePath(path):
""" Sets the winepath to path """
global winepath
winepath = path
def GetWinePath():
return winepath
def VerifyWineDrive(path = None):
""" Does a very basic check of if the given path is a valid fake windows installation
Returns False if there is no C: drive """
if not path:
path = self.default_winepath
return os.path.exists(path + "/dosdevices/c:/users/" + os.environ['USER']) and \
os.path.exists(path + "/dosdevices/c:/windows/system32") and \
os.path.exists(path + "/system.reg") and os.path.exists(path + "/userdef.reg") and \
os.path.exists(path + "/user.reg")

@ -1,489 +0,0 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
###########################################################################
# winewrite.py - description #
# ------------------------------ #
# begin : Fri Mar 26 2004 #
# copyright : (C) 2006 by Yuriy Kozlov #
# email : yuriy.kozlov@gmail.com #
# #
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################
import os
import wineread
import random
""" Provides functions for changings settings in wine """
def SetDriveMappings(drives):
""" Sets wine's drive settings """
driveletters = os.listdir(wineread.winepath + "/dosdevices")
set(driveletters)
for drive in drives[:26]:
letter = drive[1].lower()
defineDrive = False
if letter in driveletters: # The drive exists
if drive[2]: # The drive is in use
# Compare for changes
changed = False
# Check if the mapping changed
if drive[2] != os.readlink(wineread.winepath + "/dosdevices/" + letter):
changed = True
# If it's changed, it will be recreated
if changed:
os.unlink(wineread.winepath + "/dosdevices/" + letter)
defineDrive = True
else:
# Remove the drive
os.unlink(wineread.winepath + "/dosdevices/" + letter)
else: # The drive doesn't exist
if drive[2]: # The drive is in use
# Create it
defineDrive = True
else:
# Do nothing
continue
if defineDrive:
os.symlink(drive[2], wineread.winepath + "/dosdevices/" + letter)
SetDriveTypes(drives[:26])
SetShellLinks(drives[26:])
def SetShellLinks(shelllinks):
existingshelllinks = os.listdir(wineread.winepath + "/dosdevices/c:/users/" + os.environ['USER'])
set(existingshelllinks)
shellregistry = wineread.GetShellRegistry()
for link in shelllinks:
createLink = False
if link[1] in existingshelllinks: # The link exists
linkpath = wineread.winepath + "/dosdevices/c:/users/" + os.environ['USER'] + "/" + link[1]
if link[2]: # The folder is mapped
# Compare for changes
changed = False
# Check if the mapping changed
if os.path.islink(linkpath) and link[2] != os.readlink(linkpath):
changed = True
elif not os.path.islink(linkpath) and link[2] != linkpath:
changed = True
elif link[5] != shellregistry.get(link[1], wineread.defaultwinfolderspath + "\\" + link[1]):
changed = True
# If it's changed, it will be recreated
if changed:
if os.path.islink(linkpath):
os.unlink(linkpath)
else:
os.rename(linkpath,linkpath + "-backup" + str(random.randint(1,1000000)))
createLink = True
else:
# Remove the link
os.unlink(linkpath)
else: # The link doesn't exist
if link[2]: # The folder is mapped
# Create it
createLink = True
else:
# Do nothing
continue
if createLink:
os.symlink(link[2], wineread.winepath + "/dosdevices/c:/users/" + os.environ['USER'] + "/" + link[1])
if link[1] in shellregistry:
SetShellRegistry(link)
def SetShellRegistry(link):
shellfile=open('.registryshellw.reg','w')
shellfile.write("REGEDIT4\n\n[HKEY_USERS\\.Default\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders]\n")
link[5] = link[5].replace("\\","\\\\")
shellfile.write('"' + link[1] + '"="' + link[5] + '"\n')
shellfile.write("\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders]\n")
link[5] = link[5].replace("\\","\\\\")
shellfile.write('"' + link[1] + '"="' + link[5] + '"\n')
shellfile.write("\n[HKEY_USERS\\.Default\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders]\n")
shellfile.write('"' + link[1] + '"="' + "%USERPROFILE%\\\\" + link[1] + '"')
shellfile.write("\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders]\n")
shellfile.write('"' + link[1] + '"="' + "%USERPROFILE%\\\\" + link[1] + '"')
shellfile.close()
os.system("wine regedit .registryshellw.reg")
os.remove(".registryshellw.reg")
def SetKeyValues(key,settings):
""" Sets all the values in key to those from the dictionary settings """
file=open('.registrykey.reg','w')
file.write("REGEDIT4\n\n[" + key + "]\n")
for setting in settings:
# Casting to a python string is necessary for older versions of PyTQt
if str(settings[setting])[:4] == 'hex:':
file.write('"'+str(setting)+'"='+str(settings[setting])+'\n')
else:
file.write('"'+str(setting)+'"="'+str(settings[setting])+'"\n')
file.close()
os.system("wine regedit .registrykey.reg")
os.remove(".registrykey.reg")
def SetValue(key,value,data):
""" Sets the value in key to data """
file=open('.registryvalue.reg','w')
file.write("REGEDIT4\n\n[" + key + "]\n")
file.write('"' + value + '"="' + data + '"')
file.close()
os.system("wine regedit .registryvalue.reg")
os.remove(".registryvalue.reg")
def SetDriveTypes(drives):
""" Sets the type for the drives in the registry """
drivesfile=open('.registrydrives.reg','w')
drivesfile.write("REGEDIT4\n\n[HKEY_LOCAL_MACHINE\\Software\\Wine\\Drives]\n")
for drive in drives:
mapping = drive[2]
if mapping:
drivesfile.write('"' + drive[1] + '"="' + drive[3] + '"\n')
drivesfile.close()
os.system("wine regedit .registrydrives.reg")
os.remove(".registrydrives.reg")
def SetAudioDriver(driver):
""" Sets the audio driver in the registry """
SetValue("HKEY_CURRENT_USER\\Software\\Wine\\Drivers","Audio",driver)
def SetDSoundSettings(settings, app = None):
""" Sets the settings for Direct Sound in the registry """
if not app:
SetKeyValues("HKEY_CURRENT_USER\\Software\\Wine\\DirectSound", settings)
else:
SetKeyValues("HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\" +\
app + "\\DirectSound", settings)
def SetWindowSettings(settings, app = None):
""" Sets the window settings in the registry """
windowsfile=open('.registrywindows.reg','w')
if not app:
windowsfile.write("REGEDIT4\n\n[HKEY_CURRENT_USER\\Software\\Wine\\X11 Driver]\n")
else:
windowsfile.write("REGEDIT4\n\n[HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\" +\
app + "\\X11 Driver]\n")
# There is a bug in wine that doesn't allow removing of registry entries from
# a reg file, so unchecking emulate desktop can't be implemented this way yet.
for setting in settings:
if settings[setting]:
windowsfile.write('"'+str(setting)+'"="'+str(settings[setting])+'"\n')
else:
# winecfg removes the value when the emulate desktop checkbox is unchecked
windowsfile.write('"'+str(setting)+'"=-\n')
windowsfile.close()
os.system("wine regedit .registrywindows.reg")
os.remove(".registrywindows.reg")
def SetD3DSettings(settings, app = None):
""" Sets the settings for Direct3D in the registry """
if not app:
SetKeyValues("HKEY_CURRENT_USER\\Software\\Wine\\Direct3D", settings)
else:
SetKeyValues("HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\" +\
app + "\\Direct3D", settings)
def SetDesktopSettings(settings):
""" Sets the control panel \ Desktop settings in the registry """
SetKeyValues("HKEY_CURRENT_USER\\Control Panel\\Desktop", settings)
def SetWinVersion(version, app = None):
"""
Sets the windows version in the registry
Sample format for version:
( "winxp", "Windows XP", 5, 1, 0xA28, "VER_PLATFORM_WIN32_NT", "Service Pack 2", 2, 0, "WinNT")
"""
winverfile=open('.registrywinver.reg','w')
if not app:
winverfile.write("REGEDIT4\n\n[HKEY_CURRENT_USER\\Software\\Wine]\n")
winverfile.write('"Version"="' + version[0] + '"\n')
Key9x = "\n[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion]\n"
KeyNT = "\n[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion]\n"
KeyProdNT = "\n[HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\ProductOptions]\n"
KeyWindNT = "\n[HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Windows\n"
KeyEnvNT = "\n[HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment]\n"
versionnumber9x = str(version[2]) + '.' + str(version[3]) + '.' + str(version[4])
versionnumberNT = str(version[2]) + '.' + str(version[3])
if version[5] == "VER_PLATFORM_WIN32_WINDOWS":
winverfile.write(Key9x + '"VersionNumber"="' + versionnumber9x + '"\n')
winverfile.write(Key9x + '"SubVersionNumber"="' + str(version[6]) + '"\n')
winverfile.write(KeyNT + '"CSDVersion"=-\n')
winverfile.write(KeyNT + '"CurrentVersion"=-\n')
winverfile.write(KeyNT + '"CurrentBuildNumber"=-\n')
winverfile.write(KeyProdNT + '"ProductType"=-\n')
winverfile.write(KeyWindNT + '"CSDVersion"=-\n')
winverfile.write(KeyEnvNT + '"OS"=-\n')
elif version[5] == "VER_PLATFORM_WIN32_NT":
winverfile.write(KeyNT + '"CurrentVersion"="' + versionnumberNT + '"\n')
winverfile.write(KeyNT + '"CSDVersion"="' + str(version[6]) + '"\n')
winverfile.write(KeyNT + '"CurrentBuildNumber"="' + str(version[4]) + '"\n')
winverfile.write(KeyProdNT + '"ProductType"="' + str(version[9]) + '"\n')
winverfile.write(KeyWindNT + '"CSDVersion"=dword:00000' + str(version[7]) + '00\n')
winverfile.write(KeyEnvNT + '"OS"="Windows_NT"\n')
winverfile.write(Key9x + '"VersionNumber"=-\n')
winverfile.write(Key9x + '"SubVersionNumber"=-\n')
elif version[5] == "VER_PLATFORM_WIN32s":
winverfile.write(Key9x + '"VersionNumber"=-\n')
winverfile.write(Key9x + '"SubVersionNumber"=-\n')
winverfile.write(KeyNT + '"CSDVersion"=-\n')
winverfile.write(KeyNT + '"CurrentVersion"=-\n')
winverfile.write(KeyNT + '"CurrentBuildNumber"=-\n')
winverfile.write(KeyProdNT + '"ProductType"=-\n')
winverfile.write(KeyWindNT + '"CSDVersion"=-\n')
winverfile.write(KeyEnvNT + '"OS"=-\n')
else:
winverfile.write("REGEDIT4\n\n[HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\" +\
app + "]\n")
if version[0] == "global":
winverfile.write('"Version"=-\n')
else:
winverfile.write('"Version"="' + version[0] + '"\n')
winverfile.close()
os.system("wine regedit .registrywinver.reg")
os.remove(".registrywinver.reg")
def SetApps(apps):
""" Adds and removes keys for app specific settings for apps """
oldapps = wineread.GetApps()
newapps = []
# Add new app keys
for app in apps:
if app not in oldapps:
newapps.append(app)
AddApps(newapps)
# Remove removed app keys
for app in oldapps:
if app not in apps:
RemoveApp(app)
def RemoveApp(app):
""" Removes the key for settings for app """
os.system("wine regedit /D HKEY_USERS\\\\S-1-5-4\\\\Software\\\\Wine\\\\AppDefaults\\\\" +\
app)
def AddApps(apps):
""" Adds a key for app """
appsfile=open('.registryapps.reg','w')
appsfile.write("REGEDIT4\n\n")
for app in apps:
appsfile.write('[HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\' +\
app + ']\n')
appsfile.close()
os.system("wine regedit .registryapps.reg")
os.remove(".registryapps.reg")
def SetDllOverrides(overrides, app = None):
""" Sets the dll override settings in the registry """
dllfile=open('.registrydll.reg','w')
if not app:
dllfile.write("REGEDIT4\n\n[HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides]\n")
else:
dllfile.write("REGEDIT4\n\n[HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\" +\
app + "\\DllOverrides]\n")
origoverrides = wineread.GetDllOverrides(app)
for dll in list(overrides.keys()):
dllfile.write('"'+str(dll)+'"="'+str(overrides[dll])+'"\n')
for dll in list(origoverrides.keys()):
if dll not in overrides:
dllfile.write('"'+str(dll)+'"=-\n')
dllfile.close()
os.system("wine regedit .registrydll.reg")
os.remove(".registrydll.reg")
def SetDefaultBrowser(browser):
"""
Sets the default browser to browser
Doesn't set windows browsers, leaves it for the program to do.
"""
file=open('.registrybrowser.reg','w')
file.write("REGEDIT4\n")
if browser[1] == ':':
for format in wineread.default_browser_formats:
file.write("\n[HKEY_LOCAL_MACHINE\\Software\\Classes\\" +\
format + "\\shell\\open\\command]\n")
file.write('@="' + browser + '"\n')
file.close()
os.system("wine regedit .registrybrowser.reg")
os.remove(".registrybrowser.reg")
else: # winebrowser
for format in wineread.default_browser_formats:
file.write("\n[HKEY_LOCAL_MACHINE\\Software\\Classes\\" +\
format + "\\shell\\open\\command]\n")
file.write('@="winebrowser"\n')
file.close()
os.system("wine regedit .registrybrowser.reg")
os.remove(".registrybrowser.reg")
SetFirstBrowser(browser)
def SetDefaultMailer(mailer):
"""
Sets the default mailer to mailer
Doesn't set windows mailers, leaves it for the program to do.
"""
file=open('.registrymailer.reg','w')
file.write("REGEDIT4\n")
if mailer[1] == ':':
for format in wineread.default_mailer_formats:
file.write("\n[HKEY_LOCAL_MACHINE\\Software\\Classes\\" +\
format + "\\shell\\open\\command]\n")
file.write('@="' + mailer + '"\n')
file.close()
os.system("wine regedit .registrymailer.reg")
os.remove(".registrymailer.reg")
else: # winebrowser
for format in wineread.default_mailer_formats:
file.write("\n[HKEY_LOCAL_MACHINE\\Software\\Classes\\" +\
format + "\\shell\\open\\command]\n")
file.write('@="winebrowser %1"\n')
file.close()
os.system("wine regedit .registrymailer.reg")
os.remove(".registrymailer.reg")
SetFirstMailer(mailer)
def SetFirstBrowser(browser):
""" Sets the first in the list of browsers for winebrowser to use to browser """
originalbrowserlist = wineread.GetNativeBrowserList()
if browser in originalbrowserlist:
originalbrowserlist.remove(browser)
browserlist = [browser] + originalbrowserlist
browserlist = str(browserlist).strip('[]')
browserlist = browserlist.replace("'","")
browserlist = browserlist.replace(", ",",")
SetValue("HKEY_CURRENT_USER\\Software\\Wine\\WineBrowser","Browsers",browserlist)
def SetFirstMailer(mailer):
""" Sets the first in the list of mailers for winebrowser to use to mailer """
originalmailerlist = wineread.GetNativeMailerList()
if mailer in originalmailerlist:
originalmailerlist.remove(mailer)
mailerlist = [mailer] + originalmailerlist
mailerlist = str(mailerlist).strip('[]')
mailerlist = mailerlist.replace("'","")
mailerlist = mailerlist.replace(", ",",")
SetValue("HKEY_CURRENT_USER\\Software\\Wine\\WineBrowser","Mailers",mailerlist)
def CreateWineDrive(path = None):
"""
Creates a fake windows installation in path
"""
if not path:
path = wineread.default_winepath
os.system("WINEPREFIX=" + path + " winepath --wait")
# ----- Theming -----
def SetCurrentTheme(theme):
"""
Sets the current theme
theme = (theme,color,size), None if none is set
"""
if not theme:
theme = ("", "", "")
themesettings = {"ColorName":theme[1],
"SizeName":theme[2],
"ThemeActive":"1"}
if not theme[0]:
themesettings["DllName"] = ""
themesettings["ThemeActive"] = "0"
else:
themesettings["DllName"] = "C:\\\\windows\\\\Resources\\\\Themes\\\\" +\
theme[0] + "\\\\" + theme[0] +".msstyles"
themefile=open('.registrytheme.reg','w')
themefile.write("REGEDIT4\n\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\ThemeManager]\n")
for setting in themesettings:
if themesettings[setting]:
themefile.write('"'+str(setting)+'"="'+str(themesettings[setting])+'"\n')
else:
themefile.write('"'+str(setting)+'"=-\n')
themefile.close()
os.system("wine regedit .registrytheme.reg")
os.remove(".registrytheme.reg")
def SetColorSettings(colors):
""" Takes a dictionary of color settings and sets them in the registry """
SetKeyValues("HKEY_CURRENT_USER\\Control Panel\\Colors",colors)
SetKeyValues("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\ThemeManager\\Control Panel\\Colors",colors)
def SetWindowMetrics(metrics):
"""
Takes a dictionary of WindowMetrics settings and sets them in the registry
"""
SetKeyValues("HKEY_CURRENT_USER\\Control Panel\\Desktop\\WindowMetrics",metrics)
ports_translation = {"lp":"lpt","ttyS":"com"}
def CreatePorts(ports = None):
"""
Creates links to ports in dosdevices
"""
if not ports:
# Find ports in /dev
ports = ["lp0"]
for port in ports:
winport = ports_translation[port.rstrip("012345678")] +\
str(int(port.lstrip("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")) + 1)
os.symlink("/dev/" + port, wineread.winepath + "/dosdevices/" + winport)
Loading…
Cancel
Save