Browse Source

More UI work

tags/1.9.4
falkTX 11 years ago
parent
commit
e63cca4f73
8 changed files with 117 additions and 22 deletions
  1. +1
    -0
      .gitignore
  2. +1
    -1
      Makefile
  3. +0
    -0
      resources/bitmaps/button_close_down.png
  4. +1
    -1
      resources/resources.qrc
  5. +18
    -17
      resources/ui/carla_plugin.ui
  6. +13
    -2
      source/carla_shared.py
  7. +1
    -1
      source/widgets/ledbutton.py
  8. +82
    -0
      source/widgets/pixmapbutton.py

+ 1
- 0
.gitignore View File

@@ -33,6 +33,7 @@ ui_*.py
source/digitalpeakmeter.py
source/ledbutton.py
source/paramspinbox.py
source/pixmapbutton.py
source/pixmapdial.py
source/pixmapkeyboard.py
source/resources_rc.py


+ 1
- 1
Makefile View File

@@ -81,7 +81,7 @@ source/ui_%.py: resources/ui/%.ui
# -----------------------------------------------------------------------------------------------------------------------------------------
# Widgets

WIDGETS = source/digitalpeakmeter.py source/ledbutton.py source/paramspinbox.py source/pixmapdial.py source/pixmapkeyboard.py
WIDGETS = source/digitalpeakmeter.py source/ledbutton.py source/paramspinbox.py source/pixmapbutton.py source/pixmapdial.py source/pixmapkeyboard.py

WIDGETS: $(WIDGETS)



resources/bitmaps/button_close_pressed.png → resources/bitmaps/button_close_down.png View File


+ 1
- 1
resources/resources.qrc View File

@@ -38,8 +38,8 @@

<file>bitmaps/carla_about.png</file>
<file>bitmaps/button_close.png</file>
<file>bitmaps/button_close_down.png</file>
<file>bitmaps/button_close_hover.png</file>
<file>bitmaps/button_close_pressed.png</file>
<file>bitmaps/button_down.png</file>
<file>bitmaps/button_down_hover.png</file>
<file>bitmaps/button_edit.png</file>


+ 18
- 17
resources/ui/carla_plugin.ui View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>557</width>
<height>28</height>
<width>538</width>
<height>30</height>
</rect>
</property>
<property name="windowTitle">
@@ -15,7 +15,7 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>1</number>
<number>2</number>
</property>
<property name="leftMargin">
<number>0</number>
@@ -30,7 +30,7 @@
<number>2</number>
</property>
<item>
<widget class="QPushButton" name="b_enable">
<widget class="PixmapButton" name="b_enable">
<property name="minimumSize">
<size>
<width>24</width>
@@ -46,10 +46,6 @@
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/bitmaps/led-big_on.png</normaloff>:/bitmaps/led-big_on.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
@@ -65,7 +61,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="b_gui">
<widget class="PixmapButton" name="b_gui">
<property name="minimumSize">
<size>
<width>24</width>
@@ -83,7 +79,7 @@
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/bitmaps/button_gui_down.png</normaloff>:/bitmaps/button_gui_down.png</iconset>
<normaloff>:/bitmaps/button_gui.png</normaloff>:/bitmaps/button_gui.png</iconset>
</property>
<property name="iconSize">
<size>
@@ -100,7 +96,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="b_edit">
<widget class="PixmapButton" name="b_edit">
<property name="minimumSize">
<size>
<width>24</width>
@@ -118,7 +114,7 @@
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/bitmaps/button_edit_down.png</normaloff>:/bitmaps/button_edit_down.png</iconset>
<normaloff>:/bitmaps/button_edit.png</normaloff>:/bitmaps/button_edit.png</iconset>
</property>
<property name="iconSize">
<size>
@@ -287,7 +283,7 @@
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="b_up">
<widget class="PixmapButton" name="b_up">
<property name="minimumSize">
<size>
<width>12</width>
@@ -310,7 +306,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="b_close">
<widget class="PixmapButton" name="b_close">
<property name="minimumSize">
<size>
<width>12</width>
@@ -328,7 +324,7 @@
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/bitmaps/button_close_pressed.png</normaloff>:/bitmaps/button_close_pressed.png</iconset>
<normaloff>:/bitmaps/button_close.png</normaloff>:/bitmaps/button_close.png</iconset>
</property>
<property name="iconSize">
<size>
@@ -342,7 +338,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="b_down">
<widget class="PixmapButton" name="b_down">
<property name="minimumSize">
<size>
<width>12</width>
@@ -365,7 +361,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="b_restore">
<widget class="PixmapButton" name="b_restore">
<property name="minimumSize">
<size>
<width>12</width>
@@ -403,6 +399,11 @@
<extends>QPushButton</extends>
<header>ledbutton.h</header>
</customwidget>
<customwidget>
<class>PixmapButton</class>
<extends>QPushButton</extends>
<header>pixmapbutton.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../resources.qrc"/>


+ 13
- 2
source/carla_shared.py View File

@@ -2154,8 +2154,19 @@ class PluginWidget(QFrame):
#else:
#self.setWidgetColor(PALETTE_COLOR_NONE)

#self.ui.led_enable.setColor(self.ui.led_enable.BIG_RED)
#self.ui.led_enable.setChecked(False)
self.ui.b_enable.setPixmaps(":/bitmaps/button_gui.png", ":/bitmaps/button_gui_down.png", ":/bitmaps/button_gui_hover.png")
self.ui.b_gui.setPixmaps(":/bitmaps/button_gui.png", ":/bitmaps/button_gui_down.png", ":/bitmaps/button_gui_hover.png")
self.ui.b_edit.setPixmaps(":/bitmaps/button_edit.png", ":/bitmaps/button_edit_down.png", ":/bitmaps/button_edit_hover.png")

self.ui.b_up.setPixmaps(":/bitmaps/button_up.png", ":/bitmaps/button_up.png", ":/bitmaps/button_up_hover.png")
self.ui.b_down.setPixmaps(":/bitmaps/button_down.png", ":/bitmaps/button_down.png", ":/bitmaps/button_down_hover.png")
self.ui.b_restore.setPixmaps(":/bitmaps/button_restore.png", ":/bitmaps/button_restore.png", ":/bitmaps/button_restore_hover.png")
self.ui.b_close.setPixmaps(":/bitmaps/button_close.png", ":/bitmaps/button_close_down.png", ":/bitmaps/button_close_hover.png")

# TODO
self.ui.b_up.setEnabled(False)
self.ui.b_down.setEnabled(False)
self.ui.b_restore.setEnabled(False)

self.ui.led_control.setColor(self.ui.led_control.YELLOW)
self.ui.led_control.setEnabled(False)


+ 1
- 1
source/widgets/ledbutton.py View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Pixmap Button, a custom Qt4 widget
# LED Button, a custom Qt4 widget
# Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
#
# This program is free software; you can redistribute it and/or


+ 82
- 0
source/widgets/pixmapbutton.py View File

@@ -0,0 +1,82 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Pixmap Button, a custom Qt4 widget
# Copyright (C) 2013 Filipe Coelho <falktx@falktx.com>
#
# This program 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 any later version.
#
# This program 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.
#
# For a full copy of the GNU General Public License see the GPL.txt file

# ------------------------------------------------------------------------------------------------------------
# Imports (Global)

from PyQt4.QtCore import QRectF
from PyQt4.QtGui import QPainter, QPixmap, QPushButton

# ------------------------------------------------------------------------------------------------------------
# Widget Class

class PixmapButton(QPushButton):
STATE_NULL = 0
STATE_NORMAL = 1
STATE_DOWN = 2
STATE_HOVER = 3

def __init__(self, parent):
QPushButton.__init__(self, parent)

self.fPixmapNormal = QPixmap()
self.fPixmapDown = QPixmap()
self.fPixmapHover = QPixmap()
self.fPixmapRect = QRectF(0, 0, 0, 0)

self.fIsHovered = False

self.setText("")

def setPixmaps(self, normal, down, hover):
self.fPixmapNormal.load(normal)
self.fPixmapDown.load(down)
self.fPixmapHover.load(hover)

self.setPixmapSize(self.fPixmapNormal.width())

def setPixmapSize(self, size):
self.fPixmapRect = QRectF(0, 0, size, size)

self.setMinimumWidth(size)
self.setMaximumWidth(size)
self.setMinimumHeight(size)
self.setMaximumHeight(size)

def enterEvent(self, event):
self.fIsHovered = True
QPushButton.enterEvent(self, event)

def leaveEvent(self, event):
self.fIsHovered = False
QPushButton.leaveEvent(self, event)

def paintEvent(self, event):
painter = QPainter(self)

if not self.isEnabled():
painter.setOpacity(0.2)
painter.drawPixmap(self.fPixmapRect, self.fPixmapNormal, self.fPixmapRect)
elif self.isChecked() or self.isDown():
painter.drawPixmap(self.fPixmapRect, self.fPixmapDown, self.fPixmapRect)
elif self.fIsHovered:
painter.drawPixmap(self.fPixmapRect, self.fPixmapHover, self.fPixmapRect)
else:
painter.drawPixmap(self.fPixmapRect, self.fPixmapNormal, self.fPixmapRect)

event.accept()

Loading…
Cancel
Save