View Single Post
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#2
woah, lots of questions - i'm by no means an authority on anything pyqt but here goes!

1) Text Browser (Opening an HTML File, so it could assist in opening an image if you want!)
Code:
self.textBrowser = QtGui.QTextBrowser(self.tab_4)
self.textBrowser.setGeometry(QtCore.QRect(0, 10, 781, 301))
self.textBrowser.setOpenExternalLinks(True)
fsock = os.popen('cat /home/opt/healthcheck/about.txt').read()
self.textBrowser.setHtml(fsock)
# self.textBrowser.setText (fsock)
# Make the font small!!!
font = QtGui.QFont()
font.setPointSize(20)
2. Scaling of both text and image. - May i ask scaling dependent on what? As scaling normally depends on something changing... - the above example shows the font size being set/changed.
But i assume you mean auto-rotate style repositioning. What you would need to do is to read the width and height and compare it to the current max width or height (800*420 without top bar)
Another way, is to have a slide in menu like the new firefox 4 example- that way whats on your screen can stay it's normal size?

2.5. Relatedly, I need to figure out how to get button presses of the zoom/volume keys.
I think 1up in the repos is pyqt and uses these keys - http://maemo.org/downloads/product/Maemo5/1up/ - if it is, might be worth downloading the code and taking a look
My assumption, but i dont know how to map the hw keys, sorry!

3. Having portrait mode support(at least manually, through a setting).
This relates to number two! - http://forums.internettablettalk.com...t=31940&page=3 - should help!

4. No idea, sorry! Well kinda, the healthcheck code reads in and detects screen location, if you can use that to detect movements of a specific type it should work
Code:
def mouseMoveEvent(self, event):
        self.mousePressPos = QtCore.QPoint(event.pos())
        if self.mousePressPos.isNull():
            event.ignore()
            return
        self.x = self.mousePressPos.x()
        self.y = self.mousePressPos.y()
        event.accept()
        self.update()
5. I think what you mean is a context menu? - as far as i am aware you set up a menu the same as you would for the title/top menu but just call it differently?
http://www.riverbankcomputing.co.uk/...tml/qmenu.html
Code:
import sys
from PyQt4.QtCore import Qt
from PyQt4.QtGui import *

class TableWidget(QTableWidget):

    def __init__(self, parent = None):

        QTableWidget.__init__(self, parent)

    def contextMenuEvent(self, event):

        menu = QMenu(self)
        quitAction = menu.addAction("Quit")
        action = menu.exec_(self.mapToGlobal(event.pos()))
        if action == quitAction:
            qApp.quit()

app = QApplication([])
tableWidget = TableWidget()
tableWidget.show()
sys.exit(app.exec_())
Look here for more info though - http://diotavelli.net/PyQtWiki/Handl...ontext%20menus )

6. Check the healthcheck pages for multipage stuff, the tools page tools stuff mainly load up in new windows.

Sorry typed it all a bit quick, as heading out! hope that helps!
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 

The Following 5 Users Say Thank You to noobmonkey For This Useful Post: