示例#1
0
import os, sys
import codecs
import re
import ostools
from time import strftime, strptime
from PyQt5 import QtGui, QtCore, QtWidgets
from generic import RightClickList, RightClickTree
from parsetools import convertTags
from convo import PesterText

_datadir = ostools.getDataDir()

class PesterLogSearchInput(QtWidgets.QLineEdit):
    def __init__(self, theme, parent=None):
        QtWidgets.QLineEdit.__init__(self, parent)
        self.setStyleSheet(theme["convo/input/style"] + "margin-right:0px;")
    def keyPressEvent(self, event):
        QtWidgets.QLineEdit.keyPressEvent(self, event)
        if hasattr(self.parent(), 'textArea'):
            if event.key() == QtCore.Qt.Key_Return:
                self.parent().logSearch(self.text())
                if self.parent().textArea.find(self.text()):
                    self.parent().textArea.ensureCursorVisible()
        else:
            self.parent().logSearch(self.text())

class PesterLogHighlighter(QtGui.QSyntaxHighlighter):
    def __init__(self, parent):
        QtGui.QSyntaxHighlighter.__init__(self, parent)
        self.searchTerm = ""
        self.hilightstyle = QtGui.QTextCharFormat()
示例#2
0
 def __init__(self):
     self._datadir = ostools.getDataDir()
     self.home = os.getcwd()
     self.quirks = {}
     self.last = {}
     self.scripts = []
示例#3
0
import os
from string import Template
import json
import re
import codecs
import platform
from datetime import *
from time import strftime, time
from PyQt4 import QtGui, QtCore

import ostools
from mood import Mood
from dataobjs import PesterProfile, pesterQuirk, pesterQuirks
from parsetools import convertTags, addTimeInitial, themeChecker, ThemeException

_datadir = ostools.getDataDir()


class PesterLog(object):
    def __init__(self, handle, parent=None):
        global _datadir
        self.parent = parent
        self.handle = handle
        self.convos = {}
        self.logpath = _datadir + "logs"

    def log(self, handle, msg):
        if self.parent.config.time12Format():
            time = strftime("[%I:%M")
        else:
            time = strftime("[%H:%M")
示例#4
0
 def __init__(self):
     self._datadir = ostools.getDataDir()
     self.home = os.getcwd()
     self.quirks = {}
     self.last = {}
     self.load()