Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
petres committed Jul 4, 2015
1 parent 817385b commit 00d6a68
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 7 deletions.
16 changes: 15 additions & 1 deletion atomgraphicsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,25 @@
from math import exp

class AtomGraphicsView(QtGui.QGraphicsView):
mouseHolding = False
mousePressCoords = None
translateCoords = (0, 0)

def __init__(self, parent):
super(QtGui.QGraphicsView, self).__init__(parent)
self.setDragMode(QtGui.QGraphicsView.ScrollHandDrag)
#self.scaleFactor = 1

def wheelEvent(self, event):
scaleFactor = exp(event.delta()*1.0/120/5)
self.scale(scaleFactor, scaleFactor)
#print(scaleFactor)
#print(scaleFactor)

def mousePressEvent(self, event):
self.mouseHolding = True
self.mousePressCoords = (event.x(), event.y())
return super(AtomGraphicsView, self).mousePressEvent(event)

def mouseReleaseEvent(self, event):
self.mouseHolding = False
return super(AtomGraphicsView, self).mouseReleaseEvent(event)
9 changes: 9 additions & 0 deletions dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def __init__(self, parent=None):
self.pixmapItem = None
self.image = None

self.model = QtGui.QStandardItemModel(self.ui.imageListView)

def _wheel(self):
h.warn("WHEEL")

Expand All @@ -54,6 +56,13 @@ def _openFile(self):
item = QtGui.QGraphicsPixmapItem(self.pixmapItem)
self.scene.addItem(item)

item = QtGui.QStandardItem(os.path.basename(str(fileName)))
item.setCheckable(True)

self.model.appendRow(item)
self.ui.imageListView.setModel(self.model)


self._checkButtons()

def _saveFile(self):
Expand Down
41 changes: 35 additions & 6 deletions gui/base.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,35 @@
<rect>
<x>0</x>
<y>0</y>
<width>893</width>
<height>658</height>
<width>1077</width>
<height>624</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="AtomGraphicsView" name="graphicsView"/>
<layout class="QGridLayout" name="gridLayout" columnstretch="2,0" columnminimumwidth="0,80">
<item row="0" column="0">
<widget class="AtomGraphicsView" name="graphicsView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<widget class="QPushButton" name="openFileButton">
<property name="text">
Expand All @@ -33,11 +49,24 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="transformButton">
<property name="text">
<string>Transform</string>
</property>
</widget>
</item>
<item>
<widget class="QListView" name="imageListView"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
Expand Down

0 comments on commit 00d6a68

Please sign in to comment.