Пример #1
0
                'type': self.typeManager.getTypeForName(t[0]),
                'name': t[1],
                'path': t[2]
            })
        return indexes

    def getIndexesForUserContributed(self, usercontributed):
        indexes = []
        path = usercontributed.path
        indexPath = os.path.join(path, self.indexPath)
        conn = sqlite3.connect(indexPath)
        sql = 'SELECT type, name, path FROM searchIndex ORDER BY name COLLATE NOCASE'
        c = conn.execute(sql)
        data = c.fetchall()
        conn.close()
        for i in data:
            indexes.append({
                'type': self.typeManager.getTypeForName(t[0]),
                'image': self.__getTypeIconWithName(t[0]),
                'name': t[1],
                'path': t[2]
            })
        return types


if __name__ == '__main__':
    import ServerManager
    c = UserContributedManager(ServerManager.ServerManager(),
                               '../Images/icons', '../Images/types')
    print(c.getAvailableUserContributed())
Пример #2
0
			answerUser = c.fetchall()
			if len(answerUser) > 0:
				answerUser = answerUser[0]
			else:
				answerUser = ['[Deleted User]','','']
			c = conn.execute(commentsSql, (answer[1],))
			comments = c.fetchall()
			commentData = ''
			for comment in comments:
				c = conn.execute(questionUserSql, (comment[2],))
				commentUser = c.fetchall()
				if len(commentUser) > 0:
					commentUser = commentUser[0]
				else:
					commentUser = ['[Deleted User]','','']
				commentTime = time.strftime('%d-%b-%Y at %H:%M:%S', time.gmtime(comment[1]))
				commentData += commentsTemplate.replace('{{{CommentBody}}}', comment[0]).replace('{{{CommentOwnerId}}}', str(comment[2])).replace('{{{CommentDisplayname}}}',commentUser[0]).replace('{{{CommentDateTime}}}',str(commentTime))
			answerData += answerTemplate.replace('{{{AnswerScore}}}', str(answer[2])).replace('{{{AcceptedAnswer}}}', ' ').replace('{{{AnswerDateTime}}}', str(answerTime)).replace('{{{AnswerBody}}}', answer[0]).replace('{{{AnswerDisplayName}}}',answerUser[0]).replace('{{{AnswerOwnerId}}}', str(answer[3])).replace('{{{Comments}}}', commentData)
			
			
		body += answerData
		body += '</body></html>'
		conn.close()
		# return '<html><body>' + body + '</body</html>' 
		return body
		
if __name__ == '__main__':
	import ServerManager
	c = StackOverflowManager(ServerManager.ServerManager(), '../Images/icons')
		
Пример #3
0
        conn.close()
        for t in data:
            indexes.append({
                'type': self.typeManager.getTypeForName(t[0]),
                'name': t[1],
                'path': t[2]
            })
        return indexes

    def getIndexesForCheatsheet(self, cheatsheet):
        indexes = []
        path = cheatsheet.path
        indexPath = os.path.join(path, self.indexPath)
        conn = sqlite3.connect(indexPath)
        sql = 'SELECT type, name, path FROM searchIndex ORDER BY name COLLATE NOCASE'
        c = conn.execute(sql)
        data = c.fetchall()
        conn.close()
        for i in data:
            indexes.append({
                'type': self.typeManager.getTypeForName(t[0]),
                'name': t[1],
                'path': t[2]
            })
        return types


if __name__ == '__main__':
    import ServerManager
    c = CheatsheetManager(ServerManager.ServerManager(), '../Images/icons')
Пример #4
0
    Note: The code below IS executed in the Environment and can be accessed by the user!

"""
from re import match
from random import choice as choose

from TempoClock import *
from ServerManager import *
from Players import *
from Patterns import *
from Code import *
import Scale

# Default server connection and metronome

Server = ServerManager()

Clock = TempoClock()

BufferManager = BufferManager(Server)  # From Players NOT Buffers
BufferManager.sendToServer()

# Clock dependant variable - stream / inherit float / allow float/int methods and change code


class var(TimeVar):
    def __init__(self, values=[0], dur=4):

        TimeVar.__init__(self, values, dur, Clock)