Wednesday, December 3, 2008

Wordpress writing tool it's sometimes rather uncomfortable to use as, in my opinion, lacks of the flexibility to be swiftly usable for blogging.
Changing font size and type you must be done hacking around html code. I heard this is related to the design of each template which forces the usage of a standard type. Although this is logic, I still wonder if it wouldn't be possible to implement a way to easily select a custom font (even among a limited bunch) directly from the writing interface. Sometimes I just force the font selection via "MS Word or OO Word Processor" paste tool.
More than this font issue a bigger pain in the ass is when trying to post code excerpt within a blog post. When you save or publish your post, Wordpress just format and "normalize" the text. Special format or characters used can create a messy result. This is especially true when you must insert Python indented code as, among other things, the spaces will be trimmed off.
Anyway here's a trick to work this issue out.
Just enable the HTML interface and enclose the code (or any specially formatted text) between
and 
tags and this should do the trick.
Python code without

class HelloWorldWindow(QtGui.QMainWindow):
def __init__(self, parent = None):
QtGui.QMainWindow.__init__(self, parent)
self.setWindowTitle("My First Qt Window")
self.setGeometry(300,300,250,150)
self.setWindowIcon(QtGui.QIcon("C:/Python26/PyQt/Icon/gadu.png"))
self.setToolTip("Hello to this Wiz and Chips example!")
app = QtGui.QApplication(sys.argv)
main_window = HelloWorldWindow()
main_window.show()
app.exec_()
Python code with

class HelloWorldWindow(QtGui.QMainWindow):
        def __init__(self, parent = None):
            QtGui.QMainWindow.__init__(self, parent)
            self.setWindowTitle("My First Qt Window")
            self.setGeometry(300,300,250,150)
            self.setWindowIcon(QtGui.QIcon("C:/Python26/PyQt/Icon/gadu.png"))
            self.setToolTip("Hello to this Wiz and Chips example!")
app = QtGui.QApplication(sys.argv)
main_window = HelloWorldWindow()
main_window.show()
app.exec_()
Of course I look forward Wordpress introducing some sort of code auto formatting. You can see something like the used by DaniWeb forum (check this thread of mine for an example).

No comments:

Post a Comment