summaryrefslogtreecommitdiffstats
path: root/FusionIcon/util.py
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2023-01-19 02:48:19 +0100
committerSlávek Banko <slavek.banko@axis.cz>2023-01-19 02:48:19 +0100
commit695b918fbb62eaf04924bd269dd7f010ccdcd26f (patch)
tree099a9321e2aa515f5de746d73c337f31af825df5 /FusionIcon/util.py
parent92dc134f1b4cc4ad015858aba0d956205f6d1912 (diff)
downloadfusion-icon-695b918fbb62eaf04924bd269dd7f010ccdcd26f.tar.gz
fusion-icon-695b918fbb62eaf04924bd269dd7f010ccdcd26f.zip
Drop python2 support.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'FusionIcon/util.py')
-rw-r--r--FusionIcon/util.py52
1 files changed, 26 insertions, 26 deletions
diff --git a/FusionIcon/util.py b/FusionIcon/util.py
index d121334..92e0ec4 100644
--- a/FusionIcon/util.py
+++ b/FusionIcon/util.py
@@ -18,7 +18,7 @@
# Author(s): crdlb
# Copyright 2007 Christopher Williams <christopherw@verizon.net>
-import os, compizconfig, ConfigParser, time
+import os, compizconfig, configparser, time
import data as _data
from parser import options as parser_options
from environment import env
@@ -44,7 +44,7 @@ class Application(object):
self.label = installed.apps[name][2]
def launch(self):
- print ' * Launching %s' %self.label
+ print(' * Launching %s' %self.label)
run(self.command)
class Applications(dict):
@@ -69,7 +69,7 @@ class CompizOption(object):
return self.config.getboolean('compiz options', self.name)
def __set(self, value):
- print ' * Setting option %s to %s' %(self.label, value)
+ print(' * Setting option %s to %s' %(self.label, value))
self.config.set('compiz options', self.name, str(bool(value)).lower())
self.config.write(open(self.config.config_file, 'w'))
@@ -112,7 +112,7 @@ class WindowManagers(dict):
self.fallback = wm[0]
elif self:
- self.fallback = self.keys()[0]
+ self.fallback = list(self.keys())[0]
self.__set_old()
@@ -128,9 +128,9 @@ class WindowManagers(dict):
def __set(self, value):
if value in wms:
- print ' * Setting window manager to', wms[value].label
+ print(' * Setting window manager to', wms[value].label)
elif not value:
- print ' * Setting window manager to empty value'
+ print(' * Setting window manager to empty value')
self.config.set('window manager', 'active wm', str(value))
self.config.write(open(self.config.config_file, 'w'))
@@ -171,22 +171,22 @@ class WindowManagers(dict):
time.sleep(0.5)
# do it
- print ' ... executing:', ' '.join(compiz_command)
+ print(' ... executing:', ' '.join(compiz_command))
run(compiz_command, quiet=False)
elif self.active:
run(self[self.active].command)
else:
- print ' * No active WM set; not going to do anything.'
+ print(' * No active WM set; not going to do anything.')
def restart(self):
if wms.active:
- print ' * Reloading %s' %wms.active
+ print(' * Reloading %s' %wms.active)
self.start()
else:
- print ' * Not reloading, no active window manager set'
+ print(' * Not reloading, no active window manager set')
active = property(__get, __set)
@@ -213,7 +213,7 @@ class CompizDecorators(dict):
# Open CompizConfig context
if parser_options.verbose:
- print ' * Opening CompizConfig context'
+ print(' * Opening CompizConfig context')
try:
context = compizconfig.Context( \
@@ -236,24 +236,24 @@ class CompizDecorators(dict):
self.default = 'emerald'
elif self:
- self.default = self.keys()[0]
+ self.default = list(self.keys())[0]
def __set(self, decorator):
if decorator in self:
self.command.Plugin.Context.ProcessEvents()
- print ' * Setting decorator to %s ("%s")' \
- %(self[decorator].label, self[decorator].command)
+ print(' * Setting decorator to %s ("%s")' \
+ %(self[decorator].label, self[decorator].command))
self.command.Value = self[decorator].command
self.command.Plugin.Context.Write()
elif not decorator:
- print ' * Not setting decorator to none'
+ print(' * Not setting decorator to none')
def __get(self):
_decorator = [d for d in self if self.command.Value == self[d].command]
if _decorator:
decorator = _decorator[0]
else:
- print ' * Decorator "%s" is invalid.' %self.command.Value
+ print(' * Decorator "%s" is invalid.' %self.command.Value)
self.active = self.default
decorator = self.command.Value
return decorator
@@ -263,7 +263,7 @@ class CompizDecorators(dict):
class Installed(object):
def __init__(self, data):
- print ' * Searching for installed applications...'
+ print(' * Searching for installed applications...')
### Compiz Detection
bins = {}
@@ -326,7 +326,7 @@ class Installed(object):
del self.apps[app]
if parser_options.verbose:
- print output.rstrip()
+ print(output.rstrip())
compiz_optionlist = []
@@ -343,11 +343,11 @@ class Installed(object):
if data.options[option][1] not in compiz_optionlist:
del self.options[option]
-class Configuration(ConfigParser.ConfigParser):
+class Configuration(configparser.ConfigParser):
def __init__(self, data):
- ConfigParser.ConfigParser.__init__(self)
+ configparser.ConfigParser.__init__(self)
self.config_folder = data.config_folder
self.config_file = data.config_file
@@ -356,12 +356,12 @@ class Configuration(ConfigParser.ConfigParser):
# Configuration file setup
if not os.path.exists(self.config_folder):
if parser_options.verbose:
- print ' * Creating configuration folder...'
+ print(' * Creating configuration folder...')
os.makedirs(self.config_folder)
if not os.path.exists(self.config_file):
if parser_options.verbose:
- print ' * Creating configuration file...'
+ print(' * Creating configuration file...')
self.create_config_file()
try:
@@ -374,9 +374,9 @@ class Configuration(ConfigParser.ConfigParser):
except:
# back it up and make a new one
- print ' * Configuration file (%s) invalid' %self.config_file
+ print(' * Configuration file (%s) invalid' %self.config_file)
self.reset_config_file()
- print ' * Generating new configuration file'
+ print(' * Generating new configuration file')
self.create_config_file()
def create_config_file(self):
@@ -405,9 +405,9 @@ class Configuration(ConfigParser.ConfigParser):
config_backup = '%s.backup.%s' \
%(self.config_file, time.strftime('%Y%m%d%H%M%S'))
os.rename(self.config_file, config_backup)
- print ' ... backed up to:', config_backup
+ print(' ... backed up to:', config_backup)
else:
- print ' ... no configuration file found'
+ print(' ... no configuration file found')
# Instantiate...
_installed = Installed(_data)