worked on prettying up scivi.

This commit is contained in:
sccolbert
2009-12-02 20:11:49 +01:00
parent 84f9c60bf4
commit 19b5973c44
4 changed files with 23 additions and 9 deletions
@@ -248,6 +248,7 @@ cdef void rgb_2_hsv(float* RGB, float* HSV) nogil:
else:
pass
if R < G:
MIN = R
MAX = G
+3 -2
View File
@@ -66,7 +66,7 @@ class IntelligentSlider(QWidget):
return self.slider.value() * self.a + self.b
class MixerPanel(QWidget):
class MixerPanel(QtGui.QFrame):
'''A color mixer to hook up to an image.
You pass the image you the panel to operate on
and it operates on that image in place. You also
@@ -74,7 +74,8 @@ class MixerPanel(QWidget):
This callback is called every time the mixer modifies
your image.'''
def __init__(self, img):
QWidget.__init__(self)
QtGui.QFrame.__init__(self)
#self.setFrameStyle(QtGui.QFrame.Box|QtGui.QFrame.Sunken)
self.img = img
self.mixer = ColorMixer(self.img)
+6 -3
View File
@@ -1,6 +1,6 @@
import numpy as np
from PyQt4.QtGui import QWidget, QPainter, QGridLayout, QColor
from PyQt4.QtGui import QWidget, QPainter, QGridLayout, QColor, QFrame
from util import histograms
@@ -103,7 +103,7 @@ class ColorHistogram(QWidget):
self.repaint()
class QuadHistogram(QWidget):
class QuadHistogram(QFrame):
'''A class which uses ColorHistogram to draw
the 4 histograms of an image. R, G, B, and Value.
@@ -113,14 +113,17 @@ class QuadHistogram(QWidget):
'''
def __init__(self, img, layout='vertical', order=['R', 'G', 'B', 'V']):
QWidget.__init__(self)
QFrame.__init__(self)
r, g, b, v = histograms(img, 100)
self.r_hist = ColorHistogram(r, (255, 0, 0))
self.g_hist = ColorHistogram(g, (0, 255, 0))
self.b_hist = ColorHistogram(b, (0, 0, 255))
self.v_hist = ColorHistogram(v, (0, 0, 0))
self.setFrameStyle(QFrame.StyledPanel|QFrame.Sunken)
self.layout = QGridLayout(self)
self.layout.setMargin(0)
order_map = {'R': self.r_hist, 'G': self.g_hist, 'B': self.b_hist,
'V': self.v_hist}
+13 -4
View File
@@ -66,9 +66,11 @@ class ImageLabel(QLabel):
self.setPixmap(pm)
class RGBHSVDisplay(QWidget):
class RGBHSVDisplay(QFrame):
def __init__(self):
QWidget.__init__(self)
QFrame.__init__(self)
self.setFrameStyle(QtGui.QFrame.Box|QtGui.QFrame.Sunken)
self.posx_label = QLabel('X-pos:')
self.posx_value = QLabel()
self.posy_label = QLabel('Y-pos:')
@@ -129,8 +131,15 @@ class SciviImageWindow(QMainWindow):
self.setCentralWidget(self.main_widget)
self.label = ImageLabel(self, arr)
self.layout.addWidget(self.label, 0, 0)
self.layout.addLayout
self.label_container = QFrame()
self.label_container.setFrameShape(QtGui.QFrame.StyledPanel|QtGui.QFrame.Sunken)
self.label_container.setLineWidth(1)
self.label_container.layout = QtGui.QGridLayout(self.label_container)
self.label_container.layout.setMargin(0)
self.label_container.layout.addWidget(self.label, 0, 0)
self.layout.addWidget(self.label_container, 0, 0)
self.mgr.add_window(self)
self.main_widget.show()