Browse Source

Initial work for system icons

tags/v2.3.0-RC1
falkTX 3 years ago
parent
commit
1ff92d4b2c
5 changed files with 84 additions and 14 deletions
  1. +8
    -1
      resources/ui/carla_settings.ui
  2. +33
    -7
      source/frontend/carla_database.py
  3. +30
    -2
      source/frontend/carla_host.py
  4. +8
    -1
      source/frontend/carla_settings.py
  5. +5
    -3
      source/frontend/carla_shared.py

+ 8
- 1
resources/ui/carla_settings.ui View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>612</width> <width>612</width>
<height>572</height>
<height>620</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
@@ -2711,6 +2711,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="ch_main_system_icons">
<property name="text">
<string>Use system/desktop-theme icons (needs restart)</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="ch_exp_load_lib_global"> <widget class="QCheckBox" name="ch_exp_load_lib_global">
<property name="text"> <property name="text">


+ 33
- 7
source/frontend/carla_database.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Carla plugin database code # Carla plugin database code
# Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as # modify it under the terms of the GNU General Public License as
@@ -1003,7 +1003,7 @@ class SearchPluginsThread(QThread):
# Plugin Refresh Dialog # Plugin Refresh Dialog


class PluginRefreshW(QDialog): class PluginRefreshW(QDialog):
def __init__(self, parent, host):
def __init__(self, parent, host, useSystemIcons):
QDialog.__init__(self, parent) QDialog.__init__(self, parent)
self.host = host self.host = host
self.ui = ui_carla_refresh.Ui_PluginRefreshW() self.ui = ui_carla_refresh.Ui_PluginRefreshW()
@@ -1019,8 +1019,22 @@ class PluginRefreshW(QDialog):
hasWin64 = os.path.exists(os.path.join(self.host.pathBinaries, "carla-discovery-win64.exe")) hasWin64 = os.path.exists(os.path.join(self.host.pathBinaries, "carla-discovery-win64.exe"))


self.fThread = SearchPluginsThread(self, host.pathBinaries) self.fThread = SearchPluginsThread(self, host.pathBinaries)
self.fIconYes = QPixmap(":/16x16/dialog-ok-apply.svgz")
self.fIconNo = QPixmap(":/16x16/dialog-error.svgz")

# -------------------------------------------------------------------------------------------------------------
# Set-up Icons

if useSystemIcons:
self.ui.b_start.setIcon(getIcon('arrow-right', 16, 'svgz'))
self.ui.b_close.setIcon(getIcon('window-close', 16, 'svgz'))
if QT_VERSION >= 0x50600:
size = int(16 * self.devicePixelRatioF())
else:
size = 16
self.fIconYes = QPixmap(getIcon('dialog-ok-apply', 16, 'svgz').pixmap(size))
self.fIconNo = QPixmap(getIcon('dialog-error', 16, 'svgz').pixmap(size))
else:
self.fIconYes = QPixmap(":/16x16/dialog-ok-apply.svgz")
self.fIconNo = QPixmap(":/16x16/dialog-error.svgz")


# ------------------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------------------
# Set-up GUI # Set-up GUI
@@ -1387,7 +1401,7 @@ class PluginDatabaseW(QDialog):
TABLEWIDGET_ITEM_MAKER = 3 TABLEWIDGET_ITEM_MAKER = 3
TABLEWIDGET_ITEM_BINARY = 4 TABLEWIDGET_ITEM_BINARY = 4


def __init__(self, parent, host):
def __init__(self, parent, host, useSystemIcons):
QDialog.__init__(self, parent) QDialog.__init__(self, parent)
self.host = host self.host = host
self.ui = ui_carla_database.Ui_PluginDatabaseW() self.ui = ui_carla_database.Ui_PluginDatabaseW()
@@ -1401,6 +1415,7 @@ class PluginDatabaseW(QDialog):
self.fRealParent = parent self.fRealParent = parent
self.fFavoritePlugins = [] self.fFavoritePlugins = []
self.fFavoritePluginsChanged = False self.fFavoritePluginsChanged = False
self.fUseSystemIcons = useSystemIcons


self.fTrYes = self.tr("Yes") self.fTrYes = self.tr("Yes")
self.fTrNo = self.tr("No") self.fTrNo = self.tr("No")
@@ -1459,6 +1474,16 @@ class PluginDatabaseW(QDialog):
self.ui.ch_bridged_wine.setEnabled(False) self.ui.ch_bridged_wine.setEnabled(False)
self.ui.ch_bridged_wine.setVisible(False) self.ui.ch_bridged_wine.setVisible(False)


# ----------------------------------------------------------------------------------------------------
# Set-up Icons

if useSystemIcons:
self.ui.b_add.setIcon(getIcon('list-add', 16, 'svgz'))
self.ui.b_cancel.setIcon(getIcon('dialog-cancel', 16, 'svgz'))
self.ui.b_clear_filters.setIcon(getIcon('edit-clear', 16, 'svgz'))
self.ui.b_refresh.setIcon(getIcon('view-refresh', 16, 'svgz'))
self.ui.tableWidget.horizontalHeaderItem(self.TABLEWIDGET_ITEM_FAVORITE).setIcon(getIcon('bookmarks', 16, 'svgz'))

# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
# Set-up connections # Set-up connections


@@ -1656,7 +1681,7 @@ class PluginDatabaseW(QDialog):


@pyqtSlot() @pyqtSlot()
def slot_refreshPlugins(self): def slot_refreshPlugins(self):
if PluginRefreshW(self, self.host).exec_():
if PluginRefreshW(self, self.host, self.fUseSystemIcons).exec_():
self._reAddPlugins() self._reAddPlugins()


if self.fRealParent: if self.fRealParent:
@@ -2381,7 +2406,8 @@ if __name__ == '__main__':
host = _initHost("Carla2-Database", libPrefix, False, False, False) host = _initHost("Carla2-Database", libPrefix, False, False, False)
_loadHostSettings(host) _loadHostSettings(host)


gui = PluginDatabaseW(None, host)
gui = PluginDatabaseW(None, host, True)
#gui = PluginRefreshW(None, host, True)
gui.show() gui.show()


app.exit_exec() app.exit_exec()


+ 30
- 2
source/frontend/carla_host.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Carla host code # Carla host code
# Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as # modify it under the terms of the GNU General Public License as
@@ -449,6 +449,32 @@ class HostWindow(QMainWindow):


self.setupCanvas() self.setupCanvas()


# ----------------------------------------------------------------------------------------------------
# Set-up Icons

if self.fSavedSettings[CARLA_KEY_MAIN_SYSTEM_ICONS]:
self.ui.act_file_connect.setIcon(getIcon('network-connect', 16, 'svgz'))
self.ui.act_file_refresh.setIcon(getIcon('view-refresh', 16, 'svgz'))
self.ui.act_file_new.setIcon(getIcon('document-new', 16, 'svgz'))
self.ui.act_file_open.setIcon(getIcon('document-open', 16, 'svgz'))
self.ui.act_file_save.setIcon(getIcon('document-save', 16, 'svgz'))
self.ui.act_file_save_as.setIcon(getIcon('document-save-as', 16, 'svgz'))
self.ui.act_file_quit.setIcon(getIcon('application-exit', 16, 'svgz'))
self.ui.act_engine_start.setIcon(getIcon('media-playback-start', 16, 'svgz'))
self.ui.act_engine_stop.setIcon(getIcon('media-playback-stop', 16, 'svgz'))
self.ui.act_engine_panic.setIcon(getIcon('dialog-warning', 16, 'svgz'))
self.ui.act_engine_config.setIcon(getIcon('configure', 16, 'svgz'))
self.ui.act_plugin_add.setIcon(getIcon('list-add', 16, 'svgz'))
self.ui.act_plugin_add_jack.setIcon(getIcon('list-add', 16, 'svgz'))
self.ui.act_plugin_remove_all.setIcon(getIcon('edit-delete', 16, 'svgz'))
self.ui.act_canvas_arrange.setIcon(getIcon('view-sort-ascending', 16, 'svgz'))
self.ui.act_canvas_refresh.setIcon(getIcon('view-refresh', 16, 'svgz'))
self.ui.act_canvas_zoom_fit.setIcon(getIcon('zoom-fit-best', 16, 'svgz'))
self.ui.act_canvas_zoom_in.setIcon(getIcon('zoom-in', 16, 'svgz'))
self.ui.act_canvas_zoom_out.setIcon(getIcon('zoom-out', 16, 'svgz'))
self.ui.act_canvas_zoom_100.setIcon(getIcon('zoom-original', 16, 'svgz'))
self.ui.act_settings_configure.setIcon(getIcon('configure', 16, 'svgz'))

# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
# Connect actions to functions # Connect actions to functions


@@ -1145,7 +1171,8 @@ class HostWindow(QMainWindow):


def showAddPluginDialog(self): def showAddPluginDialog(self):
if self.fPluginDatabaseDialog is None: if self.fPluginDatabaseDialog is None:
self.fPluginDatabaseDialog = PluginDatabaseW(self.fParentOrSelf, self.host)
self.fPluginDatabaseDialog = PluginDatabaseW(self.fParentOrSelf, self.host,
self.fSavedSettings[CARLA_KEY_MAIN_SYSTEM_ICONS])
dialog = self.fPluginDatabaseDialog dialog = self.fPluginDatabaseDialog


ret = dialog.exec_() ret = dialog.exec_()
@@ -1912,6 +1939,7 @@ class HostWindow(QMainWindow):
CARLA_KEY_MAIN_PROJECT_FOLDER: settings.value(CARLA_KEY_MAIN_PROJECT_FOLDER, CARLA_DEFAULT_MAIN_PROJECT_FOLDER, str), CARLA_KEY_MAIN_PROJECT_FOLDER: settings.value(CARLA_KEY_MAIN_PROJECT_FOLDER, CARLA_DEFAULT_MAIN_PROJECT_FOLDER, str),
CARLA_KEY_MAIN_CONFIRM_EXIT: settings.value(CARLA_KEY_MAIN_CONFIRM_EXIT, CARLA_DEFAULT_MAIN_CONFIRM_EXIT, bool), CARLA_KEY_MAIN_CONFIRM_EXIT: settings.value(CARLA_KEY_MAIN_CONFIRM_EXIT, CARLA_DEFAULT_MAIN_CONFIRM_EXIT, bool),
CARLA_KEY_MAIN_REFRESH_INTERVAL: settings.value(CARLA_KEY_MAIN_REFRESH_INTERVAL, CARLA_DEFAULT_MAIN_REFRESH_INTERVAL, int), CARLA_KEY_MAIN_REFRESH_INTERVAL: settings.value(CARLA_KEY_MAIN_REFRESH_INTERVAL, CARLA_DEFAULT_MAIN_REFRESH_INTERVAL, int),
CARLA_KEY_MAIN_SYSTEM_ICONS: settings.value(CARLA_KEY_MAIN_SYSTEM_ICONS, CARLA_DEFAULT_MAIN_SYSTEM_ICONS, bool),
CARLA_KEY_MAIN_EXPERIMENTAL: settings.value(CARLA_KEY_MAIN_EXPERIMENTAL, CARLA_DEFAULT_MAIN_EXPERIMENTAL, bool), CARLA_KEY_MAIN_EXPERIMENTAL: settings.value(CARLA_KEY_MAIN_EXPERIMENTAL, CARLA_DEFAULT_MAIN_EXPERIMENTAL, bool),
CARLA_KEY_CANVAS_THEME: settings.value(CARLA_KEY_CANVAS_THEME, CARLA_DEFAULT_CANVAS_THEME, str), CARLA_KEY_CANVAS_THEME: settings.value(CARLA_KEY_CANVAS_THEME, CARLA_DEFAULT_CANVAS_THEME, str),
CARLA_KEY_CANVAS_SIZE: settings.value(CARLA_KEY_CANVAS_SIZE, CARLA_DEFAULT_CANVAS_SIZE, str), CARLA_KEY_CANVAS_SIZE: settings.value(CARLA_KEY_CANVAS_SIZE, CARLA_DEFAULT_CANVAS_SIZE, str),


+ 8
- 1
source/frontend/carla_settings.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Carla settings code # Carla settings code
# Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as # modify it under the terms of the GNU General Public License as
@@ -55,6 +55,7 @@ from carla_shared import (
CARLA_KEY_MAIN_REFRESH_INTERVAL, CARLA_KEY_MAIN_REFRESH_INTERVAL,
CARLA_KEY_MAIN_CONFIRM_EXIT, CARLA_KEY_MAIN_CONFIRM_EXIT,
CARLA_KEY_MAIN_SHOW_LOGS, CARLA_KEY_MAIN_SHOW_LOGS,
CARLA_KEY_MAIN_SYSTEM_ICONS,
CARLA_KEY_MAIN_EXPERIMENTAL, CARLA_KEY_MAIN_EXPERIMENTAL,
CARLA_KEY_CANVAS_THEME, CARLA_KEY_CANVAS_THEME,
CARLA_KEY_CANVAS_SIZE, CARLA_KEY_CANVAS_SIZE,
@@ -113,6 +114,7 @@ from carla_shared import (
CARLA_DEFAULT_MAIN_REFRESH_INTERVAL, CARLA_DEFAULT_MAIN_REFRESH_INTERVAL,
CARLA_DEFAULT_MAIN_CONFIRM_EXIT, CARLA_DEFAULT_MAIN_CONFIRM_EXIT,
CARLA_DEFAULT_MAIN_SHOW_LOGS, CARLA_DEFAULT_MAIN_SHOW_LOGS,
CARLA_DEFAULT_MAIN_SYSTEM_ICONS,
#CARLA_DEFAULT_MAIN_EXPERIMENTAL, #CARLA_DEFAULT_MAIN_EXPERIMENTAL,
CARLA_DEFAULT_CANVAS_THEME, CARLA_DEFAULT_CANVAS_THEME,
CARLA_DEFAULT_CANVAS_SIZE, CARLA_DEFAULT_CANVAS_SIZE,
@@ -643,6 +645,9 @@ class CarlaSettingsW(QDialog):
self.ui.ch_main_confirm_exit.setChecked( self.ui.ch_main_confirm_exit.setChecked(
settings.value(CARLA_KEY_MAIN_CONFIRM_EXIT, CARLA_DEFAULT_MAIN_CONFIRM_EXIT, bool)) settings.value(CARLA_KEY_MAIN_CONFIRM_EXIT, CARLA_DEFAULT_MAIN_CONFIRM_EXIT, bool))


self.ui.ch_main_system_icons.setChecked(
settings.value(CARLA_KEY_MAIN_SYSTEM_ICONS, CARLA_DEFAULT_MAIN_SYSTEM_ICONS, bool))

# ------------------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------------------
# Canvas # Canvas


@@ -907,6 +912,7 @@ class CarlaSettingsW(QDialog):
settings.setValue(CARLA_KEY_MAIN_USE_PRO_THEME, self.ui.ch_main_theme_pro.isChecked()) settings.setValue(CARLA_KEY_MAIN_USE_PRO_THEME, self.ui.ch_main_theme_pro.isChecked())
settings.setValue(CARLA_KEY_MAIN_PRO_THEME_COLOR, self.ui.cb_main_theme_color.currentText()) settings.setValue(CARLA_KEY_MAIN_PRO_THEME_COLOR, self.ui.cb_main_theme_color.currentText())
settings.setValue(CARLA_KEY_MAIN_REFRESH_INTERVAL, self.ui.sb_main_refresh_interval.value()) settings.setValue(CARLA_KEY_MAIN_REFRESH_INTERVAL, self.ui.sb_main_refresh_interval.value())
settings.setValue(CARLA_KEY_MAIN_SYSTEM_ICONS, self.ui.ch_main_system_icons.isChecked())


# ------------------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------------------
# Canvas # Canvas
@@ -1269,6 +1275,7 @@ class CarlaSettingsW(QDialog):
self.ui.ch_exp_prevent_bad_behaviour.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR) self.ui.ch_exp_prevent_bad_behaviour.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR)


# Temporary, until stable # Temporary, until stable
self.ui.ch_main_system_icons.setChecked(CARLA_DEFAULT_MAIN_SYSTEM_ICONS)
self.ui.cb_canvas_fancy_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY) self.ui.cb_canvas_fancy_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY)
self.ui.cb_canvas_use_opengl.setChecked(CARLA_DEFAULT_CANVAS_USE_OPENGL and self.ui.cb_canvas_use_opengl.setChecked(CARLA_DEFAULT_CANVAS_USE_OPENGL and
self.ui.cb_canvas_use_opengl.isEnabled()) self.ui.cb_canvas_use_opengl.isEnabled())


+ 5
- 3
source/frontend/carla_shared.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Common Carla code # Common Carla code
# Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as # modify it under the terms of the GNU General Public License as
@@ -184,6 +184,7 @@ CARLA_KEY_MAIN_PRO_THEME_COLOR = "Main/ProThemeColor" # str
CARLA_KEY_MAIN_REFRESH_INTERVAL = "Main/RefreshInterval" # int CARLA_KEY_MAIN_REFRESH_INTERVAL = "Main/RefreshInterval" # int
CARLA_KEY_MAIN_CONFIRM_EXIT = "Main/ConfirmExit" # bool CARLA_KEY_MAIN_CONFIRM_EXIT = "Main/ConfirmExit" # bool
CARLA_KEY_MAIN_SHOW_LOGS = "Main/ShowLogs" # bool CARLA_KEY_MAIN_SHOW_LOGS = "Main/ShowLogs" # bool
CARLA_KEY_MAIN_SYSTEM_ICONS = "Main/SystemIcons" # bool
CARLA_KEY_MAIN_EXPERIMENTAL = "Main/Experimental" # bool CARLA_KEY_MAIN_EXPERIMENTAL = "Main/Experimental" # bool


CARLA_KEY_CANVAS_THEME = "Canvas/Theme" # str CARLA_KEY_CANVAS_THEME = "Canvas/Theme" # str
@@ -259,6 +260,7 @@ CARLA_DEFAULT_MAIN_PRO_THEME_COLOR = "Black"
CARLA_DEFAULT_MAIN_REFRESH_INTERVAL = 20 CARLA_DEFAULT_MAIN_REFRESH_INTERVAL = 20
CARLA_DEFAULT_MAIN_CONFIRM_EXIT = True CARLA_DEFAULT_MAIN_CONFIRM_EXIT = True
CARLA_DEFAULT_MAIN_SHOW_LOGS = bool(not WINDOWS) CARLA_DEFAULT_MAIN_SHOW_LOGS = bool(not WINDOWS)
CARLA_DEFAULT_MAIN_SYSTEM_ICONS = False
CARLA_DEFAULT_MAIN_EXPERIMENTAL = False CARLA_DEFAULT_MAIN_EXPERIMENTAL = False


# Canvas # Canvas
@@ -622,8 +624,8 @@ def toList(value):
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Get Icon from user theme, using our own as backup (Oxygen) # Get Icon from user theme, using our own as backup (Oxygen)


def getIcon(icon, size = 16):
return QIcon.fromTheme(icon, QIcon(":/%ix%i/%s.png" % (size, size, icon)))
def getIcon(icon, size, qrcformat):
return QIcon.fromTheme(icon, QIcon(":/%ix%i/%s.%s" % (size, size, icon, qrcformat)))


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Handle some basic command-line arguments shared between all carla variants # Handle some basic command-line arguments shared between all carla variants


Loading…
Cancel
Save