#!/usr/bin/env python2.5 # # Copyright (c) 2008, Caio Begotti. All rights reserved. # PyMichaelvis: PyQt version of Vinicius Della Libera's Micha Elvis 2008 # # This file is free software. You are free to use this file in any way you like # However, if you change it you should note in this file that you did and who # you are, you also need to change the version string if you do. That way # I will not get support questions for software that is not entirely mine. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # basic modules import sys import os import re # qt's signal and slot support from PyQt4 import QtCore from PyQt4.QtCore import QString # for the GUI objects from PyQt4 import QtGui from PyQt4.QtGui import QIcon from PyQt4.QtGui import QMenu # for fetching and parsing from StringIO import StringIO import pycurl import urllib class Systray(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) if QtGui.QSystemTrayIcon.isSystemTrayAvailable(): self.quitAction = QtGui.QAction('Fechar', self) QtCore.QObject.connect(self.quitAction, QtCore.SIGNAL('triggered()'), QtGui.QApplication.instance(), QtCore.SLOT('quit()')) self.createTrayIcon() else: # it's unlikely you will ever hit this print 'No system tray available, aborting.' sys.exit(1) def textWindow(self, definition): # formatting the text to be shown self.text = QtGui.QTextEdit() self.text.setReadOnly(True) self.text.setHtml(definition) self.text.setStyleSheet("QTextEdit {font-size: 16pt;}") # window properties self.setCentralWidget(self.text) self.setWindowTitle(self.tr("PyMichaelvis 1.0")) self.setWindowIcon((QtGui.QIcon('icons/michaelvis.png'))) self.resize(400, 250) # center the window according the screen size screen = QtGui.QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2) # it's showtime self.show() def getDefinition(self): # we don't want overlapping windows self.hide() text = QtGui.QInputDialog.getText(self, self.tr('PyMichaelvis 1.0'), self.tr('
:-(
:-(