Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 9953222e79
)
r14.1.x
parent
16bbedc3ca
commit
4a49ed9306
Before Width: | Height: | Size: 397 B |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 829 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 15 KiB |
@ -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…
Reference in new issue