Karol Nowak avatar Karol Nowak committed 0cac6fa

Made space for goods images in the trade widget - loading "unknown" by default.

Comments (0)

Files changed (3)

src/lookout/qtgui/trade_form.py

 # -*- coding: utf-8 -*-
 
-# Form implementation generated from reading ui file 'trade_widget.ui'
+# Form implementation generated from reading ui file 'src/lookout/trade_widget.ui'
 #
-# Created: Sat Feb 12 01:35:10 2011
+# Created: Sat Jun 18 22:02:36 2011
 #      by: PyQt4 UI code generator 4.8.3
 #
 # WARNING! All changes made in this file will be lost!
         self.verticalLayout.addLayout(self.horizontalLayout_2)
         self.horizontalLayout_3.addLayout(self.verticalLayout)
         self.verticalLayout_3.addLayout(self.horizontalLayout_3)
+        self.horizontalLayout_4 = QtGui.QHBoxLayout()
+        self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
+        self.goods_image_label = QtGui.QLabel(TradeForm)
+        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+        sizePolicy.setHorizontalStretch(0)
+        sizePolicy.setVerticalStretch(0)
+        sizePolicy.setHeightForWidth(self.goods_image_label.sizePolicy().hasHeightForWidth())
+        self.goods_image_label.setSizePolicy(sizePolicy)
+        self.goods_image_label.setMinimumSize(QtCore.QSize(250, 250))
+        self.goods_image_label.setMaximumSize(QtCore.QSize(250, 250))
+        self.goods_image_label.setBaseSize(QtCore.QSize(250, 250))
+        self.goods_image_label.setText(_fromUtf8(""))
+        self.goods_image_label.setObjectName(_fromUtf8("goods_image_label"))
+        self.horizontalLayout_4.addWidget(self.goods_image_label)
         self.log_text = QtGui.QTextBrowser(TradeForm)
         self.log_text.setObjectName(_fromUtf8("log_text"))
-        self.verticalLayout_3.addWidget(self.log_text)
+        self.horizontalLayout_4.addWidget(self.log_text)
+        self.verticalLayout_3.addLayout(self.horizontalLayout_4)
 
         self.retranslateUi(TradeForm)
         QtCore.QMetaObject.connectSlotsByName(TradeForm)

src/lookout/qtgui/trade_widget.py

 """
 
 from PyQt4.Qt import SIGNAL
-from PyQt4.QtGui import QWidget
+from PyQt4.QtGui import QWidget, QPixmap, QImage
 
 import trade_form
 from buy_dialog import BuyDialog
         self.setupUi(self)
         self.buy_button.setEnabled(False)
         self.sell_button.setEnabled(False)
+        
+        self.goods_image_cache = {}
+        self.goods_image_cache['unknown'] = QPixmap(QImage('data/openclipart/unknown.png'))
+        self.goods_image_label.setPixmap(self.goods_image_cache['unknown'])
 
         self.connect(self.buy_button, SIGNAL("clicked()"), self.buy)
         self.connect(self.sell_button, SIGNAL("clicked()"), self.sell)

src/lookout/trade_widget.ui

     </layout>
    </item>
    <item>
-    <widget class="QTextBrowser" name="log_text"/>
+    <layout class="QHBoxLayout" name="horizontalLayout_4">
+     <item>
+      <widget class="QLabel" name="goods_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="baseSize">
+        <size>
+         <width>250</width>
+         <height>250</height>
+        </size>
+       </property>
+       <property name="text">
+        <string/>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QTextBrowser" name="log_text"/>
+     </item>
+    </layout>
    </item>
   </layout>
  </widget>
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.