Skip to content

Instantly share code, notes, and snippets.

@EntityReborn
EntityReborn / AutoCompleter.py
Created July 23, 2011 17:53
AutoCompleting QLineEdit
from PyQt4.QtCore import QEvent, Qt
from PyQt4.QtGui import QLineEdit
class MyLineEdit(QLineEdit):
def __init__(self, *args, **kwargs):
QLineEdit.__init__(self, *args, **kwargs)
self.completions = [] # All available completions
self.partials = [] # Parsed completions according to partially typed word
s = __import__("socket").socket()
s.connect(("irc.freenode.net", 6667))
s.send("NICK __import__\r\n")
s.send("USER __import__ irc.freenode.net bla :__import__\r\n")
readbuffer = ""
while True:
readbuffer += s.recv(1024)
temp = readbuffer.split("\n")
readbuffer = temp.pop()
for line in temp:
<lahwran> <__import__> [13:33:23] lahwran, someone is telling me if I bought MC in beta version, it's free updates till release, then you need to pay. Is this true?
<lahwran> they are incorrect
<lahwran> it doesn't matter when you buy minecraft; you get minecraft
<lahwran> if you bought in alpha, you bought minecraft /plus addons/
<lahwran> where addons = stuff created by mojang
<__import__> ok, so say mojang/notch updates the final client, what happens to beta buyers?
<lahwran> nothing
<lahwran> it updates as usual
<__import__> ok
<__import__> beta buyers won't get addons?
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class Info(Base):
__tablename__ = 'infos'
id = Column(Integer, primary_key=True)
keyword = Column(String, unique=True)
#!/usr/bin/env python
from PyQt4 import QtCore, QtGui
class GraphWidget(QtGui.QGraphicsView):
def __init__(self):
super(GraphWidget, self).__init__()
self.font = QtGui.QFont("System")
fontinfo = self.finfo = QtGui.QFontMetrics(self.font)
groups:
Admins:
permissions:
- '*'
inheritance:
default: false
Moderators:
permissions:
- worldguard.region.define
- worldguard.region.redefine
def launchUpdate(updated, user, ticket, appdata=None):
if appdata:
appdata = os.path.abspath(appdata)
if sys.platform == "win32":
os.putenv("APPDATA", appdata)
else:
os.environ["HOME"] = appdata
url = "minecraft.jar?user={0}&ticket={1}".format(user, ticket)
import urllib2
import subprocess
loginurl = "https://login.minecraft.net/?&user={0}&password={1}&version=9999"
user = "user"
pass_ = "pass"
loginurl = loginurl.format(user, pass_)
print "attempting login"
data = urllib2.urlopen(loginurl)
import os, sys
from subprocess import Popen
# java -cp "%APPDATA%\.minecraft\bin\*" -Djava.library.path="%APPDATA%\.minecraft\bin\natives" net.minecraft.client.Minecraft
appdata = os.path.dirname(os.path.abspath(__file__))
# java -cp ...
args = ['java', '-cp',]
import os, sys
from subprocess import Popen
# java -cp "%APPDATA%\.minecraft\bin\*" -Djava.library.path="%APPDATA%\.minecraft\bin\natives" net.minecraft.client.Minecraft
appdata = os.path.dirname(os.path.abspath(__file__))
# java -cp ...
args = ['java', '-cp',]