Karol Nowak avatar Karol Nowak committed 77f9fd4

Show goods images in buy/sell dialogs.

Comments (0)

Files changed (4)

src/lookout/buy_dialog.ui

    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>300</height>
+    <width>434</width>
+    <height>357</height>
    </rect>
   </property>
   <property name="windowTitle">
     </layout>
    </item>
    <item>
-    <widget class="QLabel" name="image_label">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="text">
-      <string>COOL IMAGE OF GOODS OR THE TRADER :D</string>
-     </property>
-    </widget>
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
+     <item>
+      <spacer name="horizontalSpacer_2">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QLabel" name="image_label">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="minimumSize">
+        <size>
+         <width>250</width>
+         <height>250</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>250</width>
+         <height>250</height>
+        </size>
+       </property>
+       <property name="text">
+        <string/>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_3">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
    </item>
    <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
+    <layout class="QHBoxLayout" name="horizontalLayout_4">
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QDialogButtonBox" name="buttonBox">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="standardButtons">
+        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+       </property>
+      </widget>
+     </item>
+    </layout>
    </item>
   </layout>
  </widget>

src/lookout/qtgui/buy_dialog.py

 
 class BuyDialog(QDialog, buy_form.Ui_Dialog):
 
-    def __init__(self, price, max_qty):
+    def __init__(self, price, max_qty, pixmap):
         QDialog.__init__(self)
         self.setupUi(self)
         self.price = price
         self.quantity_spinbox.setMaximum(max_qty)
         
         self.price_label.setText(str(price))
+        self.image_label.setPixmap(pixmap)
 
         self.connect(self.quantity_spinbox, SIGNAL("valueChanged(int)"), self.quantity_changed)
         self.quantity_spinbox.setValue(max_qty)

src/lookout/qtgui/buy_form.py

 # -*- coding: utf-8 -*-
 
-# Form implementation generated from reading ui file 'buy_dialog.ui'
+# Form implementation generated from reading ui file 'src/lookout/buy_dialog.ui'
 #
-# Created: Sat Feb 12 01:35:56 2011
+# Created: Sat Jun 18 22:43:01 2011
 #      by: PyQt4 UI code generator 4.8.3
 #
 # WARNING! All changes made in this file will be lost!
 class Ui_Dialog(object):
     def setupUi(self, Dialog):
         Dialog.setObjectName(_fromUtf8("Dialog"))
-        Dialog.resize(400, 300)
+        Dialog.resize(434, 357)
         self.verticalLayout = QtGui.QVBoxLayout(Dialog)
         self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
         self.horizontalLayout = QtGui.QHBoxLayout()
         self.total_price_label.setObjectName(_fromUtf8("total_price_label"))
         self.horizontalLayout_2.addWidget(self.total_price_label)
         self.verticalLayout.addLayout(self.horizontalLayout_2)
+        self.horizontalLayout_3 = QtGui.QHBoxLayout()
+        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
+        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        self.horizontalLayout_3.addItem(spacerItem)
         self.image_label = QtGui.QLabel(Dialog)
-        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding)
+        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
         sizePolicy.setHorizontalStretch(0)
         sizePolicy.setVerticalStretch(0)
         sizePolicy.setHeightForWidth(self.image_label.sizePolicy().hasHeightForWidth())
         self.image_label.setSizePolicy(sizePolicy)
+        self.image_label.setMinimumSize(QtCore.QSize(250, 250))
+        self.image_label.setMaximumSize(QtCore.QSize(250, 250))
+        self.image_label.setText(_fromUtf8(""))
         self.image_label.setObjectName(_fromUtf8("image_label"))
-        self.verticalLayout.addWidget(self.image_label)
+        self.horizontalLayout_3.addWidget(self.image_label)
+        spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        self.horizontalLayout_3.addItem(spacerItem1)
+        self.verticalLayout.addLayout(self.horizontalLayout_3)
+        self.horizontalLayout_4 = QtGui.QHBoxLayout()
+        self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
+        spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        self.horizontalLayout_4.addItem(spacerItem2)
         self.buttonBox = QtGui.QDialogButtonBox(Dialog)
         self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
         self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
         self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
-        self.verticalLayout.addWidget(self.buttonBox)
+        self.horizontalLayout_4.addWidget(self.buttonBox)
+        self.verticalLayout.addLayout(self.horizontalLayout_4)
 
         self.retranslateUi(Dialog)
         QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Dialog.accept)
         self.price_label.setText(QtGui.QApplication.translate("Dialog", "price", None, QtGui.QApplication.UnicodeUTF8))
         self.label_5.setText(QtGui.QApplication.translate("Dialog", "=", None, QtGui.QApplication.UnicodeUTF8))
         self.total_price_label.setText(QtGui.QApplication.translate("Dialog", "1337", None, QtGui.QApplication.UnicodeUTF8))
-        self.image_label.setText(QtGui.QApplication.translate("Dialog", "COOL IMAGE OF GOODS OR THE TRADER :D", None, QtGui.QApplication.UnicodeUTF8))
 

src/lookout/qtgui/trade_widget.py

             
             max_qty = min((available, affordable, space_available))
             
-            dialog = BuyDialog(price, max_qty)
+            dialog = BuyDialog(price, max_qty, self.goods_image_label.pixmap())
             dialog.exec_()
 
             if dialog.result():
         if selected_row is not None:
             price = int(self.ship_goods_table.item(selected_row, 1).text())
             available = int(self.ship_goods_table.item(selected_row, 0).text())
-
-            dialog = BuyDialog(price, available)
+            
+            dialog = BuyDialog(price, available, self.goods_image_label.pixmap())
             dialog.exec_()
 
             if dialog.result():
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.