Minor organization shifts
This commit is contained in:
parent
dd683a3cf7
commit
bf68bc5911
4 changed files with 74 additions and 60 deletions
11
console.py
11
console.py
|
@ -1,3 +1,4 @@
|
||||||
|
# vim: set autoindent ts=4 sts=4 sw=4 textwidth=79 expandtab:
|
||||||
# -*- coding=UTF-8; tab-width: 4 -*-
|
# -*- coding=UTF-8; tab-width: 4 -*-
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
@ -9,7 +10,11 @@ from os import remove
|
||||||
import dataobjs, generic, memos, parsetools, ostools
|
import dataobjs, generic, memos, parsetools, ostools
|
||||||
from version import _pcVersion
|
from version import _pcVersion
|
||||||
|
|
||||||
from pnc.dep.attrdict import AttrDict
|
try:
|
||||||
|
from pnc.attrdict import AttrDict
|
||||||
|
except ImportError:
|
||||||
|
# Fall back on the old location, just in case
|
||||||
|
from pnc.dep.attrdict import AttrDict
|
||||||
#~from styling import styler
|
#~from styling import styler
|
||||||
|
|
||||||
_datadir = ostools.getDataDir()
|
_datadir = ostools.getDataDir()
|
||||||
|
@ -521,7 +526,3 @@ class ConsoleInput(QtGui.QLineEdit):
|
||||||
parent.text.area.keyPressEvent(event)
|
parent.text.area.keyPressEvent(event)
|
||||||
else:
|
else:
|
||||||
super(ConsoleInput, self).keyPressEvent(event)
|
super(ConsoleInput, self).keyPressEvent(event)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# vim: set autoindent ts=4 sts=4 sw=4 textwidth=79 expandtab:
|
|
||||||
|
|
6
convo.py
6
convo.py
|
@ -15,7 +15,11 @@ from parsetools import convertTags, lexMessage, splitMessage, mecmd, colorBegin,
|
||||||
import parsetools
|
import parsetools
|
||||||
|
|
||||||
import pnc.lexercon as lexercon
|
import pnc.lexercon as lexercon
|
||||||
from pnc.dep.attrdict import AttrDict
|
try:
|
||||||
|
from pnc.attrdict import AttrDict
|
||||||
|
except ImportError:
|
||||||
|
# Fall back on the old location - just in case
|
||||||
|
from pnc.dep.attrdict import AttrDict
|
||||||
|
|
||||||
class PesterTabWindow(QtGui.QFrame):
|
class PesterTabWindow(QtGui.QFrame):
|
||||||
def __init__(self, mainwindow, parent=None, convo="convo"):
|
def __init__(self, mainwindow, parent=None, convo="convo"):
|
||||||
|
|
|
@ -2,66 +2,23 @@
|
||||||
import os, shutil, sys, getopt
|
import os, shutil, sys, getopt
|
||||||
if os.path.dirname(sys.argv[0]):
|
if os.path.dirname(sys.argv[0]):
|
||||||
os.chdir(os.path.dirname(sys.argv[0]))
|
os.chdir(os.path.dirname(sys.argv[0]))
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(level=logging.WARNING)
|
||||||
import version
|
import version
|
||||||
version.pcVerCalc()
|
version.pcVerCalc()
|
||||||
import logging
|
version._py_version_check()
|
||||||
|
|
||||||
from datetime import *
|
from datetime import *
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
from time import time
|
from time import time
|
||||||
import threading, Queue
|
import threading, Queue
|
||||||
from pnc.dep.attrdict import AttrDict
|
try:
|
||||||
|
from pnc.attrdict import AttrDict
|
||||||
logging.basicConfig(level=logging.WARNING)
|
except ImportError:
|
||||||
|
# Fall back on the old location - just in case
|
||||||
def _py_version_check():
|
logging.warning("Couldn't load attrdict from new loc; falling back")
|
||||||
# == Python Version Checking ==
|
from pnc.dep.attrdict import AttrDict
|
||||||
# Check that we're running the right version of Pesterchum.
|
|
||||||
# This is the version we need.
|
|
||||||
pyreq = {"major": 2, "minor": 7}
|
|
||||||
|
|
||||||
# Just some preprocessing to make formatting the version info a little
|
|
||||||
# easier. Note that the sys.version_info type doesn't convert to dict,
|
|
||||||
# despite having named indices like a namedtuple, so we have to do it
|
|
||||||
# manually.
|
|
||||||
# This is the version we have.
|
|
||||||
pyver = dict(zip(("major", "minor"), sys.version_info[:2]))
|
|
||||||
|
|
||||||
# Compose the base of an error message that we may use in the future.
|
|
||||||
errmsg = "ERROR: Pesterchum is designed to be run on Python \
|
|
||||||
{major}.{minor}.".format(**pyreq)
|
|
||||||
errmsg = [ errmsg ]
|
|
||||||
errmsg.append("It is not designed for use with Python {major}.{minor}.")
|
|
||||||
# Now we have a list that we can further process into a more specific
|
|
||||||
# error message.
|
|
||||||
if pyver["major"] > pyreq["major"]:
|
|
||||||
# We're using Python 3, which this script won't work with.
|
|
||||||
errmsg = errmsg.extend([
|
|
||||||
"Due to syntax differences,",
|
|
||||||
"it cannot be run with this version of Python."
|
|
||||||
])
|
|
||||||
errmsg = ' '.join(errmsg)
|
|
||||||
errmsg = errmsg.format(**pyver)
|
|
||||||
logging.critical(errmsg)
|
|
||||||
exit()
|
|
||||||
elif pyver["major"] != pyreq["major"] or pyver["minor"] < pyreq["minor"]:
|
|
||||||
# We're either not running Python 2 (we have something earlier?!) or
|
|
||||||
# we're below the minimum required minor version (e.g. 2.6 or 2.4 or
|
|
||||||
# similar).
|
|
||||||
# This means that we wouldn't have certain syntax improvements that we
|
|
||||||
# need - like inline generators, 'with' statements, lambdas, etc.
|
|
||||||
# NOTE: This MAY be lowered to 2.6 later, since there's little
|
|
||||||
# difference.
|
|
||||||
errmsg = errmsg.extend([
|
|
||||||
"This version of Python lacks certain features",
|
|
||||||
"that are necessary for it to run."
|
|
||||||
])
|
|
||||||
errmsg = ' '.join(errmsg)
|
|
||||||
errmsg = errmsg.format(**pyver)
|
|
||||||
logging.critical(errmsg)
|
|
||||||
exit()
|
|
||||||
# Actually do the version check.
|
|
||||||
_py_version_check()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import console
|
import console
|
||||||
|
|
54
version.py
54
version.py
|
@ -4,7 +4,11 @@ try:
|
||||||
except:
|
except:
|
||||||
tarfile = None
|
tarfile = None
|
||||||
import os, sys, shutil
|
import os, sys, shutil
|
||||||
from pnc.dep.attrdict import AttrDict
|
try:
|
||||||
|
from pnc.attrdict import AttrDict
|
||||||
|
except ImportError:
|
||||||
|
# Fall back on the old location - just in case
|
||||||
|
from pnc.dep.attrdict import AttrDict
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -43,6 +47,54 @@ jsodeco = json.JSONDecoder()
|
||||||
# Whether or not we've completed an update (requires a restart).
|
# Whether or not we've completed an update (requires a restart).
|
||||||
has_updated = False
|
has_updated = False
|
||||||
|
|
||||||
|
def _py_version_check():
|
||||||
|
import sys
|
||||||
|
# == Python Version Checking ==
|
||||||
|
# Check that we're running the right version of Python.
|
||||||
|
# This is the version we need.
|
||||||
|
pyreq = {"major": 2, "minor": 7}
|
||||||
|
|
||||||
|
# Just some preprocessing to make formatting the version info a little
|
||||||
|
# easier. Note that the sys.version_info type doesn't convert to dict,
|
||||||
|
# despite having named indices like a namedtuple, so we have to do it
|
||||||
|
# manually.
|
||||||
|
# This is the version we have.
|
||||||
|
pyver = dict(zip(("major", "minor"), sys.version_info[:2]))
|
||||||
|
|
||||||
|
# Compose the base of an error message that we may use in the future.
|
||||||
|
errmsg = "ERROR: Pesterchum is designed to be run on Python " + \
|
||||||
|
"{major}.{minor}.".format(**pyreq)
|
||||||
|
errmsg = [ errmsg ]
|
||||||
|
errmsg.append("It is not designed for use with Python {major}.{minor}.")
|
||||||
|
# Now we have a list that we can further process into a more specific
|
||||||
|
# error message.
|
||||||
|
if pyver["major"] > pyreq["major"]:
|
||||||
|
# We're using Python 3, which this script won't work with.
|
||||||
|
errmsg = errmsg.extend([
|
||||||
|
"Due to syntax differences,",
|
||||||
|
"it cannot be run with this version of Python."
|
||||||
|
])
|
||||||
|
errmsg = ' '.join(errmsg)
|
||||||
|
errmsg = errmsg.format(**pyver)
|
||||||
|
logger.critical(errmsg)
|
||||||
|
sys.exit()
|
||||||
|
elif pyver["major"] != pyreq["major"] or pyver["minor"] < pyreq["minor"]:
|
||||||
|
# We're either not running Python 2 (we have something earlier?!) or
|
||||||
|
# we're below the minimum required minor version (e.g. 2.6 or 2.4 or
|
||||||
|
# similar).
|
||||||
|
# This means that we wouldn't have certain syntax improvements that we
|
||||||
|
# need - like inline generators, 'with' statements, lambdas, etc.
|
||||||
|
# NOTE: This MAY be lowered to 2.6 later, since there's little
|
||||||
|
# difference.
|
||||||
|
errmsg = errmsg.extend([
|
||||||
|
"This version of Python lacks certain features",
|
||||||
|
"that are necessary for it to run."
|
||||||
|
])
|
||||||
|
errmsg = ' '.join(errmsg)
|
||||||
|
errmsg = errmsg.format(**pyver)
|
||||||
|
logger.critical(errmsg)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
# Not 100% finished - certain output formats seem odd
|
# Not 100% finished - certain output formats seem odd
|
||||||
def get_pchum_ver(raw=0, pretty=False, file=None, use_hard_coded=None):
|
def get_pchum_ver(raw=0, pretty=False, file=None, use_hard_coded=None):
|
||||||
# If use_hard_coded is None, we don't care. If it's False, we won't use it.
|
# If use_hard_coded is None, we don't care. If it's False, we won't use it.
|
||||||
|
|
Loading…
Reference in a new issue