Skip to content

Commit

Permalink
merge with svn
Browse files Browse the repository at this point in the history
git-svn-id: http://projects.conceptive.be/camelot/svn/trunk@2520 8325946a-aa55-0410-8760-f0bc8c33efaa
  • Loading branch information
erikj committed Apr 20, 2012
1 parent 7409205 commit 3928165
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 72 deletions.
14 changes: 2 additions & 12 deletions camelot/view/controls/editors/booleditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#
# ============================================================================


from PyQt4 import QtGui
from PyQt4 import QtCore
from PyQt4.QtCore import Qt
Expand All @@ -31,7 +30,6 @@
from camelot.core import constants
from camelot.core.utils import ugettext


class BoolEditor(QtGui.QCheckBox, AbstractCustomEditor):
"""Widget for editing a boolean field"""

Expand All @@ -48,16 +46,12 @@ def __init__(self,
AbstractCustomEditor.__init__(self)
self.setObjectName( field_name )
self._nullable = nullable
#if self._nullable:
# self.setTristate( True )
self.stateChanged.connect(self._state_changed)
self.clicked.connect( self._state_changed )

def set_value(self, value):
value = AbstractCustomEditor.set_value(self, value)
if value:
self.setCheckState(Qt.Checked)
#elif value==None and self._nullable:
# self.setCheckState(Qt.PartiallyChecked)
else:
self.setCheckState(Qt.Unchecked)

Expand All @@ -66,12 +60,11 @@ def get_value(self):
if value_loading is not None:
return value_loading
state = self.checkState()
#if state==Qt.PartiallyChecked:
# return None
if state==Qt.Unchecked:
return False
return True

@QtCore.pyqtSlot( bool )
def _state_changed(self, value=None):
self.editingFinished.emit()

Expand All @@ -84,7 +77,6 @@ def sizeHint(self):
size = QtGui.QComboBox().sizeHint()
return size


class TextBoolEditor(QtGui.QLabel, AbstractCustomEditor):
"""
:Parameter:
Expand Down Expand Up @@ -124,5 +116,3 @@ def set_value(self, value):
selfpalette = self.palette()
selfpalette.setColor(QtGui.QPalette.WindowText, self.color_no)
self.setPalette(selfpalette)


7 changes: 3 additions & 4 deletions camelot/view/controls/editors/charteditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ def set_value(self, value):
from camelot.container.chartcontainer import structure_to_figure_container
self._value = structure_to_figure_container( super(ChartEditor, self).set_value(value) )
self.on_draw()

def get_value(self):
return self._value

# def _get_tightbbox(self, fig, pad_inches):
# renderer = fig.canvas.get_renderer()
Expand Down Expand Up @@ -231,7 +234,3 @@ def on_draw(self):
# #self.fig.subplots_adjust(bottom=0.3, right=0.9, top=0.9, left=0.1)
# self.tight_borders(self.fig)
# self.canvas.draw()




4 changes: 2 additions & 2 deletions camelot/view/controls/editors/datetimeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def __init__(self,
for i in range(0,24)))]
self.timeedit.addItems(time_entries)
self.timeedit.setValidator(TimeValidator(self, nullable))
self.timeedit.currentIndexChanged.connect( self.editing_finished )
self.timeedit.editTextChanged.connect( self.editing_finished )
self.timeedit.activated.connect( self.editing_finished )
self.timeedit.lineEdit().editingFinished.connect( self.editing_finished )
self.timeedit.setFocusPolicy( Qt.StrongFocus )

layout.addWidget(self.timeedit, 1)
Expand Down
10 changes: 5 additions & 5 deletions camelot/view/controls/editors/smileyeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#
# ============================================================================

from PyQt4 import QtGui
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import Qt

from customeditor import CustomEditor
Expand Down Expand Up @@ -79,7 +79,7 @@ def __init__(self,
else:
self.box.setEnabled(True)

self.box.currentIndexChanged.connect(self.smiley_changed)
self.box.activated.connect( self.smiley_changed )
layout.addWidget(self.box)
layout.addStretch()
self.setLayout(layout)
Expand All @@ -90,11 +90,11 @@ def get_value(self):

def set_enabled(self, editable=True):
self.box.setEnabled(editable)

def smiley_changed(self):

@QtCore.pyqtSlot( int )
def smiley_changed(self, _index ):
self.editingFinished.emit()

def set_value(self, value):
name = CustomEditor.set_value(self, value)
self.box.setCurrentIndex( self.position_by_name[name] )

Loading

0 comments on commit 3928165

Please sign in to comment.