Browse Source

Remove option for disable skins; Allow user to change skins

tags/v1.9.11
FilipeCSnuk 6 years ago
parent
commit
b23ad020fc
6 changed files with 71 additions and 52 deletions
  1. +14
    -21
      resources/ui/carla_settings.ui
  2. +13
    -10
      source/carla_host.py
  3. +0
    -3
      source/carla_settings.py
  4. +0
    -2
      source/carla_shared.py
  5. +33
    -4
      source/carla_skin.py
  6. +11
    -12
      source/widgets/racklistwidget.py

+ 14
- 21
resources/ui/carla_settings.ui View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>612</width>
<height>520</height>
<height>572</height>
</rect>
</property>
<property name="minimumSize">
@@ -313,7 +313,17 @@
<string>Interface</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="4" column="1">
<item row="3" column="0">
<widget class="QLabel" name="label_main_refresh_interval">
<property name="text">
<string>Interface refresh interval:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="sb_main_refresh_interval">
<property name="suffix">
<string> ms</string>
@@ -329,7 +339,7 @@
</property>
</widget>
</item>
<item row="4" column="2">
<item row="3" column="2">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -345,23 +355,6 @@
</property>
</spacer>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_main_refresh_interval">
<property name="text">
<string>Interface refresh interval:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="ch_main_use_custom_skins">
<property name="text">
<string>Use custom plugin slot skins</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="ch_main_show_logs">
<property name="text">
@@ -369,7 +362,7 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="ch_main_confirm_exit">
<property name="text">
<string>Show a confirmation dialog before quitting</string>


+ 13
- 10
source/carla_host.py View File

@@ -586,6 +586,18 @@ class HostWindow(QMainWindow):

pitem.recreateWidget(True)

def changePluginSkin(self, pluginId, skin):
if pluginId > self.fPluginCount:
return

pitem = self.fPluginList[pluginId]

if pitem is None:
return

self.host.set_custom_data(pluginId, CUSTOM_DATA_TYPE_PROPERTY, "CarlaSkin", skin)
pitem.recreateWidget(newSkin = skin)

def switchPlugins(self, pluginIdA, pluginIdB):
if pluginIdA == pluginIdB:
return
@@ -594,8 +606,6 @@ class HostWindow(QMainWindow):
if pluginIdA >= self.fPluginCount or pluginIdB >= self.fPluginCount:
return

useCustomSkins = self.fSavedSettings[CARLA_KEY_MAIN_USE_CUSTOM_SKINS]

self.host.switch_plugins(pluginIdA, pluginIdB)

itemA = self.fPluginList[pluginIdA]
@@ -1197,7 +1207,7 @@ class HostWindow(QMainWindow):

@pyqtSlot(int, str)
def slot_handlePluginAddedCallback(self, pluginId, pluginName):
pitem = self.ui.listWidget.createItem(pluginId, self.fSavedSettings[CARLA_KEY_MAIN_USE_CUSTOM_SKINS])
pitem = self.ui.listWidget.createItem(pluginId)

self.fPluginList.append(pitem)
self.fPluginCount += 1
@@ -1593,7 +1603,6 @@ class HostWindow(QMainWindow):
CARLA_KEY_MAIN_PROJECT_FOLDER: settings.value(CARLA_KEY_MAIN_PROJECT_FOLDER, CARLA_DEFAULT_MAIN_PROJECT_FOLDER, type=str),
CARLA_KEY_MAIN_CONFIRM_EXIT: settings.value(CARLA_KEY_MAIN_CONFIRM_EXIT, CARLA_DEFAULT_MAIN_CONFIRM_EXIT, type=bool),
CARLA_KEY_MAIN_REFRESH_INTERVAL: settings.value(CARLA_KEY_MAIN_REFRESH_INTERVAL, CARLA_DEFAULT_MAIN_REFRESH_INTERVAL, type=int),
CARLA_KEY_MAIN_USE_CUSTOM_SKINS: settings.value(CARLA_KEY_MAIN_USE_CUSTOM_SKINS, CARLA_DEFAULT_MAIN_USE_CUSTOM_SKINS, type=bool),
CARLA_KEY_MAIN_EXPERIMENTAL: settings.value(CARLA_KEY_MAIN_EXPERIMENTAL, CARLA_DEFAULT_MAIN_EXPERIMENTAL, type=bool),
CARLA_KEY_CANVAS_THEME: settings.value(CARLA_KEY_CANVAS_THEME, CARLA_DEFAULT_CANVAS_THEME, type=str),
CARLA_KEY_CANVAS_SIZE: settings.value(CARLA_KEY_CANVAS_SIZE, CARLA_DEFAULT_CANVAS_SIZE, type=str),
@@ -1677,12 +1686,6 @@ class HostWindow(QMainWindow):
elif self.host.is_engine_running():
self.host.patchbay_refresh(self.fExternalPatchbay)

for pitem in self.fPluginList:
if pitem is None:
break
pitem.setUsingSkins(self.fSavedSettings[CARLA_KEY_MAIN_USE_CUSTOM_SKINS])
pitem.recreateWidget()

# --------------------------------------------------------------------------------------------------------
# About (menu actions)



+ 0
- 3
source/carla_settings.py View File

@@ -363,7 +363,6 @@ class CarlaSettingsW(QDialog):
self.ui.cb_main_theme_color.setCurrentIndex(self.ui.cb_main_theme_color.findText(settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, type=str)))
self.ui.sb_main_refresh_interval.setValue(settings.value(CARLA_KEY_MAIN_REFRESH_INTERVAL, CARLA_DEFAULT_MAIN_REFRESH_INTERVAL, type=int))
self.ui.ch_main_confirm_exit.setChecked(settings.value(CARLA_KEY_MAIN_CONFIRM_EXIT, CARLA_DEFAULT_MAIN_CONFIRM_EXIT, type=bool))
self.ui.ch_main_use_custom_skins.setChecked(settings.value(CARLA_KEY_MAIN_USE_CUSTOM_SKINS, CARLA_DEFAULT_MAIN_USE_CUSTOM_SKINS, type=bool))

# ----------------------------------------------------------------------------------------------------
# Canvas
@@ -545,7 +544,6 @@ class CarlaSettingsW(QDialog):
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_REFRESH_INTERVAL, self.ui.sb_main_refresh_interval.value())
settings.setValue(CARLA_KEY_MAIN_USE_CUSTOM_SKINS, self.ui.ch_main_use_custom_skins.isChecked())

# ----------------------------------------------------------------------------------------------------
# Canvas
@@ -685,7 +683,6 @@ class CarlaSettingsW(QDialog):
self.ui.cb_main_theme_color.setCurrentIndex(self.ui.cb_main_theme_color.findText(CARLA_DEFAULT_MAIN_PRO_THEME_COLOR))
self.ui.sb_main_refresh_interval.setValue(CARLA_DEFAULT_MAIN_REFRESH_INTERVAL)
self.ui.ch_main_confirm_exit.setChecked(CARLA_DEFAULT_MAIN_CONFIRM_EXIT)
self.ui.ch_main_use_custom_skins.setChecked(CARLA_DEFAULT_MAIN_USE_CUSTOM_SKINS)
self.ui.ch_main_show_logs.setChecked(CARLA_DEFAULT_MAIN_SHOW_LOGS)

# ----------------------------------------------------------------------------------------------------


+ 0
- 2
source/carla_shared.py View File

@@ -192,7 +192,6 @@ CARLA_KEY_MAIN_USE_PRO_THEME = "Main/UseProTheme" # bool
CARLA_KEY_MAIN_PRO_THEME_COLOR = "Main/ProThemeColor" # str
CARLA_KEY_MAIN_REFRESH_INTERVAL = "Main/RefreshInterval" # int
CARLA_KEY_MAIN_CONFIRM_EXIT = "Main/ConfirmExit" # bool
CARLA_KEY_MAIN_USE_CUSTOM_SKINS = "Main/UseCustomSkins" # bool
CARLA_KEY_MAIN_SHOW_LOGS = "Main/ShowLogs" # bool
CARLA_KEY_MAIN_EXPERIMENTAL = "Main/Experimental" # bool

@@ -252,7 +251,6 @@ CARLA_DEFAULT_MAIN_USE_PRO_THEME = True
CARLA_DEFAULT_MAIN_PRO_THEME_COLOR = "Black"
CARLA_DEFAULT_MAIN_REFRESH_INTERVAL = 20
CARLA_DEFAULT_MAIN_CONFIRM_EXIT = True
CARLA_DEFAULT_MAIN_USE_CUSTOM_SKINS = True
CARLA_DEFAULT_MAIN_SHOW_LOGS = bool(not WINDOWS)
CARLA_DEFAULT_MAIN_EXPERIMENTAL = False



+ 33
- 4
source/carla_skin.py View File

@@ -384,7 +384,7 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):

if isCalfSkin:
self.b_gui.setPixmaps(":/bitmaps/button_calf2.png", ":/bitmaps/button_calf2_down.png", ":/bitmaps/button_calf2_hover.png")
elif self.fPluginInfo['iconName'] == "distrho" or self.fSkinStyle in ("3bandeq","3bandsplitter","pingpongpan"):
elif self.fPluginInfo['iconName'] == "distrho" or self.fSkinStyle in ("3bandeq","3bandsplitter","pingpongpan", "nekobi"):
self.b_gui.setPixmaps(":/bitmaps/button_distrho.png", ":/bitmaps/button_distrho_down.png", ":/bitmaps/button_distrho_hover.png")
elif self.fPluginInfo['iconName'] == "file":
self.b_gui.setPixmaps(":/bitmaps/button_file.png", ":/bitmaps/button_file_down.png", ":/bitmaps/button_file_hover.png")
@@ -1002,8 +1002,12 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
# Expand/Minimize

actCompact = menu.addAction(self.tr("Expand") if isinstance(self, PluginSlot_Compact) else self.tr("Minimize"))
actSkin = menu.addAction(self.tr("Change Skin..."))
menu.addSeparator()

if isinstance(self, PluginSlot_Classic):
actCompact.setEnabled(False)

# -------------------------------------------------------------
# Move up and down

@@ -1088,6 +1092,31 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
# FIXME
gCarla.gui.compactPlugin(self.fPluginId)

# -------------------------------------------------------------
# Expand/Minimize

elif actSel == actSkin:
skinList = [
"default",
"3bandeq",
"rncbc",
"calf_black",
"calf_blue",
"classic",
"openav-old",
"openav",
"zynfx",
"presets",
"mpresets",
]

skin = QInputDialog.getItem(self, self.tr("Change Skin"),
self.tr("Change Skin to:"),
skinList, editable=False)
if not all(skin):
return
gCarla.gui.changePluginSkin(self.fPluginId, skin[0])

# -------------------------------------------------------------
# Move up and down

@@ -1895,10 +1924,10 @@ def getSkinStyle(host, pluginId):
return "default"

def createPluginSlot(parent, host, pluginId, options):
if not options['useSkins']:
return PluginSlot_Classic(parent, host, pluginId)
skinStyle = options['skin'] or getSkinStyle(host, pluginId)

skinStyle = getSkinStyle(host, pluginId)
if skinStyle == "classic":
return PluginSlot_Classic(parent, host, pluginId)

if "compact" in skinStyle or options['compact']:
return PluginSlot_Compact(parent, host, pluginId, skinStyle)


+ 11
- 12
source/widgets/racklistwidget.py View File

@@ -44,7 +44,7 @@ class RackListItem(QListWidgetItem):
kRackItemType = QListWidgetItem.UserType + 1
kMinimumWidth = 620

def __init__(self, parent, pluginId, useSkins):
def __init__(self, parent, pluginId):
QListWidgetItem.__init__(self, parent, self.kRackItemType)
self.host = parent.host

@@ -62,9 +62,12 @@ class RackListItem(QListWidgetItem):
self.fPluginId = pluginId
self.fWidget = None

compact = bool(self.host.get_custom_data_value(pluginId, CUSTOM_DATA_TYPE_PROPERTY, "CarlaSkinIsCompacted") == "true")
skin = self.host.get_custom_data_value(pluginId, CUSTOM_DATA_TYPE_PROPERTY, "CarlaSkin")

self.fOptions = {
'compact': bool(self.host.get_custom_data_value(pluginId, CUSTOM_DATA_TYPE_PROPERTY, "CarlaSkinIsCompacted") == "true"),
'useSkins': useSkins
'skin' : skin,
'compact' : compact and skin != "classic",
}

self.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)
@@ -112,9 +115,6 @@ class RackListItem(QListWidgetItem):
def isCompacted(self):
return self.fOptions['compact']

def isUsingSkins(self):
return self.fOptions['useSkins']

def isGuiShown(self):
if self.fWidget is None or self.fWidget.b_gui is not None:
return None
@@ -139,9 +139,6 @@ class RackListItem(QListWidgetItem):
def setCompacted(self, compact):
self.fOptions['compact'] = compact

def setUsingSkins(self, useSkins):
self.fOptions['useSkins'] = useSkins

# --------------------------------------------------------------------------------------------------------

def compact(self):
@@ -154,9 +151,11 @@ class RackListItem(QListWidgetItem):
return
self.recreateWidget(True)

def recreateWidget(self, invertCompactOption = False, firstInit = False):
def recreateWidget(self, invertCompactOption = False, firstInit = False, newSkin = ''):
if invertCompactOption:
self.fOptions['compact'] = not self.fOptions['compact']
if newSkin:
self.fOptions['skin'] = newSkin

wasGuiShown = None

@@ -235,8 +234,8 @@ class RackListWidget(QListWidget):

# --------------------------------------------------------------------------------------------------------

def createItem(self, pluginId, useSkins):
return RackListItem(self, pluginId, useSkins)
def createItem(self, pluginId):
return RackListItem(self, pluginId)

def getPluginCount(self):
return self.fParent.getPluginCount()


Loading…
Cancel
Save