[PyQt] Is it possible to embed a font in a PyQt application?
I'm currently working on a small application for learning the International Phonetic Alphabet ( http://en.wikipedia.org/wiki/IPA_chart_for_English_dialects). I have a font which can display these symbols but I would like to avoid its installation in the system just for displaying it. Is it possible to make qt display fonts read from files and not from the system installed fonts? Thanks, Serge Weinstock ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Compile error ld: library not found for -lqpycore
Hello list, I am trying to compile PyQt on a Mac Leopard 10.5.6 and I get the following compiler error when running make install (after make): ld: library not found for -lqpycore collect2: ld returned 1 exit status make[1]: *** [QtCore.so] Error 1 make: *** [install] Error 2 I followed exactly the installation instructions given on this website: http://www.oak-tree.us/blog/index.php/2009/05/12/pyqt-mac Has somebody a clue what could potentially the cause for that error? Thanks Regards, Matthias ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Compile error ld: library not found for -lqpycore
Additional info, I'm using the following versions: PyQt-mac-gpl-4.5.1.tar.gz qt-sdk-mac-opensource-2009.03.dmg sip-4.8.1.tar.gz xcode313_2736_developerdvd.dmg On Sun, 12 Jul 2009 12:40:18 +0200 Matthias Guggenmos matthias.guggen...@freenet.de wrote: Hello list, I am trying to compile PyQt on a Mac Leopard 10.5.6 and I get the following compiler error when running make install (after make): ld: library not found for -lqpycore collect2: ld returned 1 exit status make[1]: *** [QtCore.so] Error 1 make: *** [install] Error 2 I followed exactly the installation instructions given on this website: http://www.oak-tree.us/blog/index.php/2009/05/12/pyqt-mac Has somebody a clue what could potentially the cause for that error? Thanks Regards, Matthias ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Is it possible to embed a font in a PyQt application?
On Sun, 12 Jul 2009 11:27:05 +0100, Serge Weinstock serge.weinst...@googlemail.com wrote: I'm currently working on a small application for learning the International Phonetic Alphabet ( http://en.wikipedia.org/wiki/IPA_chart_for_English_dialects). I have a font which can display these symbols but I would like to avoid its installation in the system just for displaying it. Is it possible to make qt display fonts read from files and not from the system installed fonts? QFontDatabase::addApplicationFont(). It of course also transparently supports reading the font from Qt resources. -- Giovanni Bajo Develer S.r.l. http://www.develer.com ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] pyqt and gstreamer/phonon examples
Hi , I am very new to pyqt and I am looking for examples to pyqt and gstreamer . Although i have seen audio example . I didn't see any video example more specifically I wanted to make an equivalent to this example . http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.html except for qt rather than gtk.. Is there a place i can get more documentation about pyqt and gstreamer.. more specifiically : Some questions in my mind were : In the example gtk.drawingarea is used for the video ... what widget would i use in case of qt and how to syn message to that widget ... -- A-M-I-T S|S ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Is it possible to embed a font in a PyQt application?
Thanks, Serge 2009/7/12 Giovanni Bajo ra...@develer.com On Sun, 12 Jul 2009 11:27:05 +0100, Serge Weinstock serge.weinst...@googlemail.com wrote: I'm currently working on a small application for learning the International Phonetic Alphabet ( http://en.wikipedia.org/wiki/IPA_chart_for_English_dialects). I have a font which can display these symbols but I would like to avoid its installation in the system just for displaying it. Is it possible to make qt display fonts read from files and not from the system installed fonts? QFontDatabase::addApplicationFont(). It of course also transparently supports reading the font from Qt resources. -- Giovanni Bajo Develer S.r.l. http://www.develer.com ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] troubles using my Qwt designer plugin with the designer coming with PPyQt-Py2.6-gpl-4.5.1-1.exe
Hi Phil, I am building a PyQwt package with the MS Visual C++ 2008 Express Edition on Windows, but I have a problem with the Qwt plugin for the designer that is delivered with PyQt-Py2.6-gpl-4.5.1-1.exe. In the process I have built Qt-4.5.1 with MSVC-2008 using configure.exe without any options. My Qwt designer plugin works with the designer in the Qt build tree (after copying it to the designer plugin directory in the Qt build tree) but not with the designer in the Python/PyQt4 tree (after copying it in the designer plugin directory in the Python/PyQt4 tree. Did you use any options when building Qt-4.5.1? (the PyQwt extension module is working). Regards -- Gerard ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] A few issues with pyuic4
On Sat, 11 Jul 2009 11:04:19 +0200, Hans-Peter Jansen h...@urpla.net wrote: Hi Phil, attached .ui demonstrates a few issues of pyuic4: - ignores stretch factors in verticalLayout - ignores all tableView attributes As a bonus, I've attached a minor bugfix for the chart example ;-). The pie rubber band selection still does not work correct (it arbitrarily selects pie slices under certain conditions), but at least, it doesn't throw exceptions anymore.. Hopefully all fixed in tonight's snapshot. Thanks, Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Re: QImage constructors
On Thu, 09 Jul 2009 14:47:25 +0200, Giovanni Bajo ra...@develer.com wrote: Hi Phil, QImage has four different constructors that use existing pixel data: QImage(uchar *data, int width, int height, Format format); QImage(const uchar *data, int width, int height, Format format); QImage(uchar *data, int width, int height, int bytesPerLine, Format format); QImage(const uchar *data, int width, int height, int bytesPerLine, Format format); The const uchar * are semantically different from the uchar * ones; quoting the Assistant of the const version: = Unlike the similar QImage constructor that takes a non-const data buffer, this version [the const one] will never alter the contents of the buffer. For example, calling QImage::bits() will return a deep copy of the image, rather than the buffer passed to the constructor. This allows for the efficiency of constructing a QImage from raw data, without the possibility of the raw data being changed. = Unfortunately it looks like PyQt does not wrap the non-const version. This is specifically useful because I'm trying to construct QImage over a shared memory area and I would like to be able to modify it in-place. Since QSharedMemory.data() returns a sip.voidptr, I suggest declaring the missing constructors as taking a void* as first argument for now; this would be backward compatible and make my own use case work. For Python 3.0, you might want to explore the usage of bytes() vs bytearray(). Let me know if it makes sense. Thanks! In tonight's snapshot - I'll leave the testing to you... Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Problem with colors and QSciScintilla
I hope that someone can help me. Best regards. Christophe hello christophe here's a basic line-based custom lexer that should get you started: import sys from PyQt4 import QtCore, QtGui, Qsci class MainWindow(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) self.setWindowTitle('Custom Lexer Example') self.setGeometry(QtCore.QRect(50,200,400,400)) self.editor = Qsci.QsciScintilla(self) self.editor.setUtf8(True) self.editor.setMarginWidth(2, 15) self.editor.setFolding(True) self.setCentralWidget(self.editor) self.lexer = CustomLexer(self.editor) self.editor.setLexer(self.lexer) self.editor.setText('\n# sample source\n\nfoo = 1\nbar = 2\n') class CustomLexer(Qsci.QsciLexerCustom): def __init__(self, parent): Qsci.QsciLexerCustom.__init__(self, parent) self._styles = { 0: 'Default', 1: 'Comment', 2: 'Key', 3: 'Assignment', 4: 'Value', } for key,value in self._styles.iteritems(): setattr(self, value, key) def description(self, style): return self._styles.get(style, '') def defaultColor(self, style): if style == self.Default: return QtGui.QColor('#00') elif style == self.Comment: return QtGui.QColor('#C0C0C0') elif style == self.Key: return QtGui.QColor('#CC') elif style == self.Assignment: return QtGui.QColor('#CC') elif style == self.Value: return QtGui.QColor('#00CC00') return Qsci.QsciLexerCustom.defaultColor(self, style) def styleText(self, start, end): editor = self.editor() if editor is None: return # scintilla works with encoded bytes, not decoded characters. # this matters if the source contains non-ascii characters and # a multi-byte encoding is used (e.g. utf-8) source = '' if end editor.length(): end = editor.length() if end start: if sys.hexversion = 0x0206: # faster when styling big files, but needs python 2.6 source = bytearray(end - start) editor.SendScintilla( editor.SCI_GETTEXTRANGE, start, end, source) else: source = unicode(editor.text() ).encode('utf-8')[start:end] if not source: return # the line index will also be needed to implement folding index = editor.SendScintilla(editor.SCI_LINEFROMPOSITION, start) if index 0: # the previous state may be needed for multi-line styling pos = editor.SendScintilla( editor.SCI_GETLINEENDPOSITION, index - 1) state = editor.SendScintilla(editor.SCI_GETSTYLEAT, pos) else: state = self.Default set_style = self.setStyling self.startStyling(start, 0x1f) # scintilla always asks to style whole lines for line in source.splitlines(True): length = len(line) if line.startswith('#'): state = self.Comment else: # the following will style lines like x = 0 pos = line.find('=') if pos 0: set_style(pos, self.Key) set_style(1, self.Assignment) length = length - pos - 1 state = self.Value else: state = self.Default set_style(length, state) # folding implementation goes here index += 1 if __name__ == __main__: app = QtGui.QApplication(sys.argv) app.connect(app, QtCore.SIGNAL('lastWindowClosed()'), QtCore.SLOT('quit()')) win = MainWindow() win.show() sys.exit(app.exec_()) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Problem with colors and QSciScintilla
Your example is great. Easy to understand. Thanks a lot ! :-) With this, I could start to study how to do more sophisticated things like folding. Christophe an happy man. :-D Baz Walter a écrit : I hope that someone can help me. Best regards. Christophe hello christophe here's a basic line-based custom lexer that should get you started: import sys from PyQt4 import QtCore, QtGui, Qsci class MainWindow(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) self.setWindowTitle('Custom Lexer Example') self.setGeometry(QtCore.QRect(50,200,400,400)) self.editor = Qsci.QsciScintilla(self) self.editor.setUtf8(True) self.editor.setMarginWidth(2, 15) self.editor.setFolding(True) self.setCentralWidget(self.editor) self.lexer = CustomLexer(self.editor) self.editor.setLexer(self.lexer) self.editor.setText('\n# sample source\n\nfoo = 1\nbar = 2\n') class CustomLexer(Qsci.QsciLexerCustom): def __init__(self, parent): Qsci.QsciLexerCustom.__init__(self, parent) self._styles = { 0: 'Default', 1: 'Comment', 2: 'Key', 3: 'Assignment', 4: 'Value', } for key,value in self._styles.iteritems(): setattr(self, value, key) def description(self, style): return self._styles.get(style, '') def defaultColor(self, style): if style == self.Default: return QtGui.QColor('#00') elif style == self.Comment: return QtGui.QColor('#C0C0C0') elif style == self.Key: return QtGui.QColor('#CC') elif style == self.Assignment: return QtGui.QColor('#CC') elif style == self.Value: return QtGui.QColor('#00CC00') return Qsci.QsciLexerCustom.defaultColor(self, style) def styleText(self, start, end): editor = self.editor() if editor is None: return # scintilla works with encoded bytes, not decoded characters. # this matters if the source contains non-ascii characters and # a multi-byte encoding is used (e.g. utf-8) source = '' if end editor.length(): end = editor.length() if end start: if sys.hexversion = 0x0206: # faster when styling big files, but needs python 2.6 source = bytearray(end - start) editor.SendScintilla( editor.SCI_GETTEXTRANGE, start, end, source) else: source = unicode(editor.text() ).encode('utf-8')[start:end] if not source: return # the line index will also be needed to implement folding index = editor.SendScintilla(editor.SCI_LINEFROMPOSITION, start) if index 0: # the previous state may be needed for multi-line styling pos = editor.SendScintilla( editor.SCI_GETLINEENDPOSITION, index - 1) state = editor.SendScintilla(editor.SCI_GETSTYLEAT, pos) else: state = self.Default set_style = self.setStyling self.startStyling(start, 0x1f) # scintilla always asks to style whole lines for line in source.splitlines(True): length = len(line) if line.startswith('#'): state = self.Comment else: # the following will style lines like x = 0 pos = line.find('=') if pos 0: set_style(pos, self.Key) set_style(1, self.Assignment) length = length - pos - 1 state = self.Value else: state = self.Default set_style(length, state) # folding implementation goes here index += 1 if __name__ == __main__: app = QtGui.QApplication(sys.argv) app.connect(app, QtCore.SIGNAL('lastWindowClosed()'), QtCore.SLOT('quit()')) win = MainWindow() win.show() sys.exit(app.exec_()) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Problem with colors and QSciScintilla
Baz Walter, I don't know if you are in the riverbanks'team but it could be very usefull to put your example in the official documentation. Regards. Christophe. projetmbc a écrit : Your example is great. Easy to understand. Thanks a lot ! :-) With this, I could start to study how to do more sophisticated things like folding. Christophe an happy man. :-D Baz Walter a écrit : I hope that someone can help me. Best regards. Christophe hello christophe here's a basic line-based custom lexer that should get you started: import sys from PyQt4 import QtCore, QtGui, Qsci class MainWindow(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) self.setWindowTitle('Custom Lexer Example') self.setGeometry(QtCore.QRect(50,200,400,400)) self.editor = Qsci.QsciScintilla(self) self.editor.setUtf8(True) self.editor.setMarginWidth(2, 15) self.editor.setFolding(True) self.setCentralWidget(self.editor) self.lexer = CustomLexer(self.editor) self.editor.setLexer(self.lexer) self.editor.setText('\n# sample source\n\nfoo = 1\nbar = 2\n') class CustomLexer(Qsci.QsciLexerCustom): def __init__(self, parent): Qsci.QsciLexerCustom.__init__(self, parent) self._styles = { 0: 'Default', 1: 'Comment', 2: 'Key', 3: 'Assignment', 4: 'Value', } for key,value in self._styles.iteritems(): setattr(self, value, key) def description(self, style): return self._styles.get(style, '') def defaultColor(self, style): if style == self.Default: return QtGui.QColor('#00') elif style == self.Comment: return QtGui.QColor('#C0C0C0') elif style == self.Key: return QtGui.QColor('#CC') elif style == self.Assignment: return QtGui.QColor('#CC') elif style == self.Value: return QtGui.QColor('#00CC00') return Qsci.QsciLexerCustom.defaultColor(self, style) def styleText(self, start, end): editor = self.editor() if editor is None: return # scintilla works with encoded bytes, not decoded characters. # this matters if the source contains non-ascii characters and # a multi-byte encoding is used (e.g. utf-8) source = '' if end editor.length(): end = editor.length() if end start: if sys.hexversion = 0x0206: # faster when styling big files, but needs python 2.6 source = bytearray(end - start) editor.SendScintilla( editor.SCI_GETTEXTRANGE, start, end, source) else: source = unicode(editor.text() ).encode('utf-8')[start:end] if not source: return # the line index will also be needed to implement folding index = editor.SendScintilla(editor.SCI_LINEFROMPOSITION, start) if index 0: # the previous state may be needed for multi-line styling pos = editor.SendScintilla( editor.SCI_GETLINEENDPOSITION, index - 1) state = editor.SendScintilla(editor.SCI_GETSTYLEAT, pos) else: state = self.Default set_style = self.setStyling self.startStyling(start, 0x1f) # scintilla always asks to style whole lines for line in source.splitlines(True): length = len(line) if line.startswith('#'): state = self.Comment else: # the following will style lines like x = 0 pos = line.find('=') if pos 0: set_style(pos, self.Key) set_style(1, self.Assignment) length = length - pos - 1 state = self.Value else: state = self.Default set_style(length, state) # folding implementation goes here index += 1 if __name__ == __main__: app = QtGui.QApplication(sys.argv) app.connect(app, QtCore.SIGNAL('lastWindowClosed()'), QtCore.SLOT('quit()')) win = MainWindow() win.show() sys.exit(app.exec_()) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt