def getFaves(self): file = os.path.join(self.FULLPATH, FILENAME).decode('utf-8') faves = [] index = 0 label_numeric = LABEL_NUMERIC if self.MODE == 'folder': folderCfg = os.path.join(self.FULLPATH, FOLDERCFG) numeric = parameters.getParam('NUMERICAL', folderCfg) if numeric: label_numeric = numeric.lower() == 'true' if label_numeric: label_numeric = LABEL_NUMERIC_QL if self.MODE != 'xbmc': try: current, dirs, files = sfile.walk(self.FULLPATH) dirs = sorted(dirs, key=str.lower) for dir in dirs: path = os.path.join(self.FULLPATH, dir) folderCfg = os.path.join(path, FOLDERCFG) folderCfg = parameters.getParams(folderCfg) lock = parameters.getParam('LOCK', folderCfg) if lock: continue colour = parameters.getParam('COLOUR', folderCfg) thumb = getFolderThumb(path) label = dir if colour and colour.lower() <> 'none': label = '[COLOR %s]%s[/COLOR]' % (colour, label) label, index = utils.addPrefixToLabel( index, label, label_numeric) fave = [label, thumb, os.path.join(self.PATH, dir), True] faves.append(fave) except Exception, e: pass
def cutCopyFolder(folder, cut=True): reset() xbmcgui.Window(10000).setProperty( 'SF_FILE', folder) xbmcgui.Window(10000).setProperty( 'SF_FOLDER', folder.rsplit(os.sep, 1)[0]) xbmcgui.Window(10000).clearProperty('SF_CMD') xbmcgui.Window(10000).setProperty( 'SF_TYPE', 'cutfolder' if cut else 'copyfolder') file = os.path.join(folder, FOLDERCFG) cfg = parameters.getParams(file) thumb = parameters.getParam('ICON', cfg) fanart = parameters.getParam('FANART', cfg) desc = parameters.getParam('DESC', cfg) _setPasteProperties(thumb, fanart, desc) return True
def getFaves(self): file = os.path.join(self.FULLPATH, FILENAME).decode('utf-8') faves = [] index = 0 label_numeric = LABEL_NUMERIC if self.MODE == 'folder': folderCfg = os.path.join(self.FULLPATH, FOLDERCFG) numeric = parameters.getParam('NUMERICAL', folderCfg) if numeric: label_numeric = numeric.lower() == 'true' if label_numeric: label_numeric = LABEL_NUMERIC_QL if self.MODE != 'xbmc': try: current, dirs, files = sfile.walk(self.FULLPATH) dirs = sorted(dirs, key=str.lower) for dir in dirs: path = os.path.join(self.FULLPATH, dir) folderCfg = os.path.join(path, FOLDERCFG) folderCfg = parameters.getParams(folderCfg) lock = parameters.getParam('LOCK', folderCfg) if lock: continue colour = parameters.getParam('COLOUR', folderCfg) thumb = getFolderThumb(path) label = dir if colour and colour.lower() <> 'none': label = '[COLOR %s]%s[/COLOR]' % (colour, label) label, index = utils.addPrefixToLabel(index, label, label_numeric) fave = [label, thumb, os.path.join(self.PATH, dir), True] faves.append(fave) except Exception, e: pass
def getFolderThumb(path, isXBMC=False): import parameters cfg = os.path.join(path, FOLDERCFG) cfg = parameters.getParams(cfg) thumb = parameters.getParam('ICON', cfg) fanart = parameters.getParam('FANART', cfg) if thumb and fanart: return thumb, fanart if isXBMC: thumb = thumb if (thumb != None) else 'DefaultFolder.png' fanart = fanart if (fanart != None) else FANART return thumb, fanart if not INHERIT: thumb = thumb if (thumb != None) else ICON fanart = fanart if (fanart != None) else FANART return thumb, fanart import locking if not locking.unlocked(path): thumb = thumb if (thumb != None) else ICON fanart = fanart if (fanart != None) else FANART return thumb, fanart import favourite faves = favourite.getFavourites(os.path.join(path, FILENAME), 1) if len(faves) < 1: thumb = thumb if (thumb != None) else ICON fanart = fanart if (fanart != None) else FANART return thumb, fanart tFave = faves[0][1] fFave = favourite.getFanart(faves[0][2]) thumb = thumb if (thumb != None) else tFave fanart = fanart if (fanart != None) else fFave fanart = fanart if (fanart and len(fanart) > 0) else FANART return thumb, fanart
def getFolderThumb(path, isXBMC=False): import parameters cfg = os.path.join(path, FOLDERCFG) cfg = parameters.getParams(cfg) thumb = parameters.getParam('ICON', cfg) fanart = parameters.getParam('FANART', cfg) if thumb and fanart: return thumb, fanart if isXBMC: thumb = thumb if (thumb != None) else 'DefaultFolder.png' fanart = fanart if (fanart != None) else FANART return thumb, fanart if not INHERIT: thumb = thumb if (thumb != None) else ICON fanart = fanart if (fanart != None) else FANART return thumb, fanart import locking if not locking.unlocked(path): thumb = thumb if (thumb != None) else ICON fanart = fanart if (fanart != None) else FANART return thumb, fanart import favourite faves = favourite.getFavourites(os.path.join(path, FILENAME), 1) if len(faves) < 1: thumb = thumb if (thumb != None) else ICON fanart = fanart if (fanart != None) else FANART return thumb, fanart tFave = faves[0][1] fFave = favourite.getFanart(faves[0][2]) thumb = thumb if (thumb != None) else tFave fanart = fanart if (fanart != None) else fFave fanart = fanart if (fanart and len(fanart) > 0) else FANART return thumb, fanart
def getFaves(self): file = os.path.join(self.FULLPATH, FILENAME).decode('utf-8') faves = [] index = 0 label_numeric = LABEL_NUMERIC if self.MODE == 'folder': folderCfg = os.path.join(self.FULLPATH, FOLDERCFG) numeric = parameters.getParam('NUMERICAL', folderCfg) if numeric: label_numeric = numeric.lower() == 'true' if label_numeric: label_numeric = LABEL_NUMERIC_QL if self.MODE != 'xbmc': try: current, dirs, files = sfile.walk(self.FULLPATH) dirs = sorted(dirs, key=str.lower) for dir in dirs: path = os.path.join(self.FULLPATH, dir) folderCfg = os.path.join(path, FOLDERCFG) folderCfg = parameters.getParams(folderCfg) lock = parameters.getParam('LOCK', folderCfg) if lock: continue colour = parameters.getParam('COLOUR', folderCfg) thumb = getFolderThumb(path) label = dir if colour and colour.lower() <> 'none': label = '[COLOR %s]%s[/COLOR]' % (colour, label) label, index = utils.addPrefixToLabel( index, label, label_numeric) fave = [label, thumb, os.path.join(self.PATH, dir), True] faves.append(fave) except Exception as e: pass items = favourite.getFavourites(file, chooser=True) sortorder = 0 if self.MODE == 'folder': folderCfg = os.path.join(self.FULLPATH, FOLDERCFG) try: sortorder = int(parameters.getParam('SORT', folderCfg)) except: sortorder = 0 if sortorder == 0: sortorder = 1 if ALPHA_SORT else 2 if sortorder == 1: #ALPHA_SORT: items = sorted(items, key=lambda x: utils.CleanForSort(x)) if not label_numeric: faves.extend(items) else: for fave in items: label = fave[0] thumb = fave[1] cmd = fave[2] label, index = utils.addPrefixToLabel(index, label, label_numeric) faves.append([label, thumb, cmd]) return faves
from PyQt4 import QtGui from PyQt4 import QtCore import time import sys import math import myGui import functions import SocketServer import threading import socket import random import parameters import datetime from collections import deque params=parameters.getParams() socket.setdefaulttimeout(2) class Server(QtGui.QWidget): def __init__(self,server, bind_and_activate=True): super(Server, self).__init__() # Activate the server; this will keep running until you # interrupt the program with Ctrl-C HOST=params['serverIP'] PORT=params['port'] self.server=server
#Import the necessary files. import numpy as np import matplotlib.pyplot as plt import stablab from stablab.get_profile import get_profile from parameters import getParams from profile_jacobian import profile_jacobian from profile_ode import profile_ode from profile_bc import profile_bc if __name__ == "__main__": # Get the parameters for the system. params = getParams() sol = { 'dim': 2, 'F': profile_ode, # F is the profile ode 'Flinear': profile_jacobian, # J is the profile ode Jacobian 'UL': np.array([params['v_minus'], params['e_minus']]), 'UR': np.array([params['v_plus'], params['e_plus']]), 'tol': 1e-7, 'BC': profile_bc, 'BClen': 2 } # Get the profile for the system. [s, p] = get_profile(params, sol, tol=1e-8, num_inf=2, timeout=50) #Setup the domain and the mapped range. x = np.linspace(s['L'], s['R'], 2000)