import sys
import re
from Tkinter import *
def urlReWrite(lameURL):
pat1 = r'.+(/public_html/)(.+)'
chip = re.match(pat1, lameURL)
goodURL = "http://digitalaphasia.com/" + chip.group(2)
return goodURL
class ClearApp:
def __init__(self, parent=0):
self.mainWindow = Frame(parent)
# Create the entry widget
self.entry = Entry(self.mainWindow, width=50)
# self.entry.insert(0,"Enter the URL here")
self.entry.pack(fill=X)
# now add the 2 buttons, use a grooved effect
fButtons = Frame(self.mainWindow, border=2, relief="groove")
bConvert = Button(fButtons, text="Convert",
width=8, height=1, command=self.convertURL)
bConvert.pack(side="left", padx=10, pady=1)
fButtons.pack(fill=X)
self.mainWindow.pack()
# set the title
self.mainWindow.master.title("URL converter")
def convertURL(self):
lameURL = self.entry.get()
self.entry.delete(0,END)
self.entry.insert(0, urlReWrite(lameURL))
app = ClearApp()
app.mainWindow.mainloop()
Tuesday, 24 August 2010
It was time to write a python script to convert the 'copy to clipboard' data that filezilla generates, to something that can be used when posting links around the place. filezilla tends to output the URL with certain private FTP details, which is fine - but not great for spreading around. This thing looks at the link and rewrites it to the HTTP equivalent, nice for a couple of minutes work. As an added bonus the app copies the newly formatted link to my clipboard. The one thing that i did not manage to figure out was how to get the existing clipboard data into the textfield without having to ctrl+v.. something for a rainy day.
Monday, 23 August 2010
NASA LRV

so a while back i did an un-textured/un-materialed version of the NASA moon LRV from the apollo missions. It's about 4 meg and passes 1m vertices.
Most of the model was built quite fast (2 days), the sticking point was how to get a decent looking tire texture. It proved to be possible in two ways - geometry and texture. Eventually i went for a procedural texture to reduce the amount of vertices in the model, the downside is that the geometry within the tire doesn't look right. It sucks quite badly :)
some study notes on pyQt4

OK. i'm done with python pyQt4 for a while. stuff that i experimented with is available at
http://digitalaphasia.com/python-scripts/
One of the python scripts is a bezier/cubic spline drawing interface, which when you are done, (hit S ) a spline.txt will appear in the same directory as the script with pyQt code that was used to produce your created spline. i hope to one day find a use for it.. i have been sourcing a few thesis' about constructing a programming language for typeface definitions. Maybe a semi automatic modular type creator program.. is in the books.
One of the python scripts is a bezier/cubic spline drawing interface, which when you are done, (hit S ) a spline.txt will appear in the same directory as the script with pyQt code that was used to produce your created spline. i hope to one day find a use for it.. i have been sourcing a few thesis' about constructing a programming language for typeface definitions. Maybe a semi automatic modular type creator program.. is in the books.
my notes:
dir(QtGui.QPainter) >>>
'background' ---- 'drawArc', 'drawChord', 'drawConvexPolygon', 'drawEllipse', 'drawImage', 'drawLine', 'drawLines', 'drawPath', 'drawPicture', 'drawPie', 'drawPixmap', 'drawPoint', 'drawPoints', 'drawPolygon', 'drawPolyline', 'drawRect', 'drawRects', 'drawRoundRect', 'drawRoundedRect', 'drawText', 'drawTiledPixmap' ---- 'begin','end', ---- 'fillPath', fillRect',
'setOpacity', 'setPen',
dir(QtGui.QPainter.drawPolyline())
first argument of unbound method must have type 'QPainter'
QPainter.drawPolyline(QPointF, ...):
QPainter.drawPolyline(QPolygonF):
QPainter.drawPolyline(QPoint, ...):
QPainter.drawPolyline(QPolygon):
dir(QtGui.QPolygonF) >>>
----'append', 'at', 'boundingRect', 'clear', 'contains', 'containsPoint', 'count', 'data', 'fill', 'first', 'indexOf', 'insert', 'intersected', 'isClosed', 'isEmpty', 'last', 'lastIndexOf', 'mid', 'prepend', 'remove', 'replace', 'size', 'subtracted', 'toPolygon', 'translate', 'translated', 'united', 'value'
dir(QtGui.QPen) >>>
'brush', 'capStyle', 'color', 'dashOffset', 'dashPattern', 'isCosmetic', 'isSolid', 'joinStyle', 'miterLimit', 'setBrush', 'setCapStyle', 'setColor', 'setCosmetic', 'setDashOffset', 'setDashPattern', 'setJoinStyle', 'setMiterLimit', 'setStyle', 'setWidth', 'setWidthF', 'style', 'width', 'widthF']
Draws arc inside the rect r with start angle a and arc length alen.
first argument of unbound method must have type 'QPainter'
QPainter.drawArc(QRectF, int, int):
QPainter.drawArc(QRect, int, int):
QPainter.drawArc(int, int, int, int, int, int):
dir(QtCore) -abbridged-
'QByteArray','QChar','QDate', 'QDateTime', 'QEasingCurve', 'QEvent',
'QLine', 'QLineF', 'QLocale', 'QMargins', 'QObject', 'QPauseAnimation', 'QPersistentModelIndex', 'QPluginLoader', 'QPoint', 'QPointF', 'QRect', 'QRectF', 'QSize', 'QSizeF', 'QString', 'QStringList', 'QStringMatcher', 'QStringRef', 'qRound', 'qRound64', 'qSetFieldWidth', 'qSetPadChar', 'qSetRealNumberPrecision', 'qUncompress',
Friday, 20 August 2010
First.
It is time to chronicle some of my learnings in a more structured way. Usually i stick my sketches and code doodles on www.digitalaphasia.com, let's see if this new blog makes a difference to the way i work.
Subscribe to:
Posts (Atom)