Viewing file: mouse_backend.py (1.86 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# mouse_backend.py - backend code for mouse configuration # # Copyright (C) 2002, 2003 Red Hat, Inc. # Copyright (C) 2002, 2003 Brent Fox <bfox@redhat.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. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import sys import os
class MouseBackend:
def writeMouseFile(self, name, gpm, Xemu3, xprotocol, iprotocol, device, doDebug=None): if doDebug: #If we're in debug mode, just print what we would otherwise write to the file print ('FULLNAME="%s"' %name) print ('MOUSETYPE="%s"' %gpm) print ('XEMU3="%s"' %Xemu3) print ('XMOUSETYPE="%s"' %xprotocol) if iprotocol: print ('IMOUSETYPE="%s"' %iprotocol) print ('DEVICE=/dev/input/mice') else: #This is the real thing, so write the file fd = open('/etc/sysconfig/mouse', 'w') fd.write('FULLNAME="%s"\n' %name) fd.write('MOUSETYPE="%s"\n' %gpm) fd.write('XEMU3="%s"\n' %Xemu3) fd.write('XMOUSETYPE="%s"\n' %xprotocol) if iprotocol: fd.write('IMOUSETYPE="%s"\n' %iprotocol) fd.write('DEVICE=/dev/input/mice\n') fd.close()
def restartGpm(self): os.system("/sbin/service gpm condrestart")
|