-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore Qt backend with fixes (and interface selector)
Use it by default everywhere but MATE and GNOME. Now with Qt5 support and theme icons for stuff.
- Loading branch information
Showing
8 changed files
with
189 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# -*- python -*- | ||
# This file is part of Fusion-icon. | ||
|
||
# Fusion-icon 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. | ||
# | ||
# Fusion-icon 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, see <http://www.gnu.org/licenses/>. | ||
# | ||
# Author(s): crdlb, nesl247 | ||
# | ||
# Copyright 2007 Christopher Williams <[email protected]> | ||
|
||
import sys | ||
from util import env | ||
import start | ||
|
||
interfaces={ | ||
'qt': 'Qt', | ||
'gtk': 'GTK+', | ||
} | ||
|
||
def import_interface(interface): | ||
try: | ||
if interface in interfaces: | ||
print(' * Using the ' + interfaces[interface] + ' Interface') | ||
__import__('FusionIcon.interface_' + interface) | ||
|
||
else: | ||
print(' *** Error: "' + interface + '" interface is invalid, this should not happen') | ||
raise SystemExit | ||
|
||
except ImportError as e: | ||
if [i for i in interfaces if 'interface_' + i in str(e)]: | ||
print(' * Interface not installed') | ||
else: | ||
print(' * ' + str(e)) | ||
|
||
#doesn't work so remove it from the dict | ||
del interfaces[interface] | ||
if interfaces: | ||
print(' ... Trying another interface') | ||
choose_interface() | ||
else: | ||
print(' *** Error: All interfaces failed, aborting!') | ||
raise SystemExit | ||
|
||
def choose_interface(try_first=None): | ||
|
||
chosen_interface = None | ||
|
||
# handle explicit choice first | ||
if try_first: | ||
if try_first in interfaces: | ||
chosen_interface = try_first | ||
else: | ||
raise SystemExit(' *** Error: No such interface: ' + try_first) | ||
else: | ||
|
||
# use qt for gnome; qt for everything else: | ||
if 'gtk' in interfaces and (env.desktop == 'mate' or env.desktop == 'gnome'): | ||
chosen_interface = 'gtk' | ||
elif 'qt' in interfaces: | ||
chosen_interface = 'qt' | ||
elif 'gtk' in interfaces: | ||
chosen_interface = 'gtk' | ||
# interfaces is empty | ||
else: | ||
raise SystemExit(' *** no available interfaces, this should not happen') | ||
|
||
import_interface(chosen_interface) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- python -*- | ||
|
||
import main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# -*- python -*- | ||
# This file is part of Fusion-icon. | ||
|
||
# Fusion-icon 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. | ||
# | ||
# Fusion-icon 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, see <http://www.gnu.org/licenses/>. | ||
|
||
# Author(s): xsacha, XRevan86, raveit65 | ||
|
||
import sys, os, time | ||
try: | ||
from PyQt5 import QtWidgets, QtGui, QtCore | ||
from PyQt5.QtWidgets import QApplication, QMenu, QActionGroup, QSystemTrayIcon | ||
except ImportError: | ||
from PyQt4 import QtGui, QtCore | ||
from PyQt4.QtGui import QApplication, QMenu, QActionGroup, QSystemTrayIcon | ||
if tuple(map(int, (QtCore.QT_VERSION_STR.split('.')))) < (4, 6, 0): | ||
raise ImportError('Qt 4.6.x or later required') | ||
from FusionIcon.start import wms, apps, options, decorators, init | ||
|
||
class Build(QApplication): | ||
def reload_wm(self): | ||
wms.restart() | ||
|
||
def toggleWM(self, wm): | ||
if wms.active != wm: | ||
wms.active = wm | ||
wms.start() | ||
|
||
def toggleOP(self, option): | ||
options[option].enabled = not options[option].enabled | ||
if wms.active == 'compiz': | ||
wms.start() | ||
|
||
def toggleWD(self, decorator): | ||
decorators.active = decorator | ||
|
||
def __init__(self, parent=None): | ||
QtCore.QObject.__init__(self, parent) | ||
if not QSystemTrayIcon.isSystemTrayAvailable(): | ||
raise SystemExit('Notification area is not available.') | ||
self.Tray = QSystemTrayIcon(QtGui.QIcon.fromTheme('fusion-icon')) | ||
self.Tray.setToolTip('Compiz Icon') | ||
self.Tray.managerMenu = QMenu() | ||
self.Tray.optionsMenu = QMenu() | ||
self.Tray.decoratorMenu = QMenu() | ||
self.groupManager = QActionGroup(self.Tray.managerMenu) | ||
self.groupDecorator = QActionGroup(self.Tray.decoratorMenu) | ||
|
||
for wm in wms.ordered_list: | ||
actionWM = self.groupManager.addAction(self.Tray.managerMenu.addAction(wms[wm].label, lambda val=wm : self.toggleWM(val))) | ||
actionWM.setCheckable(True) | ||
if wms.active == wm: | ||
actionWM.setChecked(True) | ||
|
||
for option in options: | ||
actionOP = self.Tray.optionsMenu.addAction(options[option].label, lambda val=option: self.toggleOP(val)) | ||
actionOP.setCheckable(True) | ||
if not options[option].sensitive: | ||
actionOP.setEnabled(False) | ||
actionOP.setChecked(options[option].enabled) | ||
|
||
for decorator in decorators: | ||
actionWD = self.groupDecorator.addAction(self.Tray.decoratorMenu.addAction(decorators[decorator].label, lambda val=decorator: self.toggleWD(val))) | ||
actionWD.setCheckable(True) | ||
if decorators.active == decorator: | ||
actionWD.setChecked(True) | ||
|
||
self.Tray.menu = QMenu() | ||
|
||
if 'ccsm' in apps: | ||
self.Tray.menu.addAction(QtGui.QIcon.fromTheme('preferences-system'), apps['ccsm'].label, lambda: run(['ccsm'])) | ||
if 'emerald theme manager' in apps: | ||
self.Tray.menu.addAction(QtGui.QIcon.fromTheme('emerald-theme-manager', QtGui.QIcon('/usr/share/pixmaps/emerald-theme-manager-icon.png')), \ | ||
apps['emerald theme manager'].label, lambda: run(apps['emerald theme manager'].command)) | ||
if 'ccsm' in apps or 'emerald theme manager' in apps: | ||
self.Tray.menu.addSeparator() | ||
|
||
self.Tray.menu.addAction(QtGui.QIcon.fromTheme('view-refresh'), 'Reload Window Manager', self.reload_wm) | ||
self.Tray.menu.addAction(QtGui.QIcon.fromTheme('view-restore'), 'Select Window Manager').setMenu(self.Tray.managerMenu) | ||
self.Tray.menu.addAction(QtGui.QIcon.fromTheme('document-properties'), 'Compiz Options').setMenu(self.Tray.optionsMenu) | ||
self.Tray.menu.addAction(QtGui.QIcon.fromTheme('view-fullscreen'), 'Select Window Decorator').setMenu(self.Tray.decoratorMenu) | ||
self.Tray.menu.addSeparator() | ||
self.Tray.menu.addAction(QtGui.QIcon.fromTheme('application-exit'), 'Quit', self.quit) | ||
self.Tray.setContextMenu(self.Tray.menu) | ||
self.Tray.show() | ||
init() | ||
|
||
Build(sys.argv).exec_() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
PREFIX = '/usr' | ||
DESTDIR = '/' | ||
interfaces = 'gtk' | ||
interfaces = 'qt gtk' | ||
|
||
all: | ||
@python setup.py build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters