mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
Returned util.py
This commit is contained in:
parent
f08ccbd45d
commit
a5fc96eb73
Binary file not shown.
@ -13,6 +13,7 @@ import configaccepted
|
||||
import configwindow
|
||||
import dataengine
|
||||
import reinit
|
||||
from util import *
|
||||
|
||||
|
||||
|
||||
|
36
source/contents/code/util.py
Normal file
36
source/contents/code/util.py
Normal file
@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from shutil import copyfile
|
||||
from PyKDE4.kdecore import *
|
||||
|
||||
|
||||
|
||||
class Util():
|
||||
def __init__(self, applet):
|
||||
self.applet = applet
|
||||
|
||||
def createDirectory(self, name):
|
||||
if not os.path.isdir(name):
|
||||
try:
|
||||
os.mkdir(name)
|
||||
except:
|
||||
print 'Failed to create directory: ' + name
|
||||
|
||||
def kdeHome(self):
|
||||
return unicode(KGlobal.dirs().localkdedir())
|
||||
|
||||
def createNotifyrc(self):
|
||||
print '[%s] creating notifyrc' % (self.applet._name)
|
||||
self.createDirectory(self.kdeHome() + 'share/apps/%s' % self.applet._name)
|
||||
|
||||
source = self.applet.package().path() + 'contents/misc/%s.notifyrc' % self.applet._name
|
||||
destination = self.kdeHome() + 'share/apps/%s/%s.notifyrc' % (self.applet._name, self.applet._name)
|
||||
copyfile(source, destination)
|
||||
|
||||
def createConfig(self):
|
||||
self.createDirectory(self.kdeHome() + 'share/apps/%s' % self.applet._name)
|
||||
|
||||
source = self.applet.package().path() + 'contents/misc/%s.ini' % self.applet._name
|
||||
destination = self.kdeHome() + 'share/apps/%s/%s.ini' % (self.applet._name, self.applet._name)
|
||||
copyfile(source, destination)
|
Loading…
Reference in New Issue
Block a user