Example #1
0
	def __init__(self, type):
		Converter.__init__(self, type)
		if type == "WithSeconds":
			self.type = self.WITH_SECONDS
		elif type == "InMinutes":
			self.type = self.IN_MINUTES
		elif type == "Date":
			self.type = self.DATE
		elif type == "AsLength":
			self.type = self.AS_LENGTH
		elif type == "AsLengthHourMin":
			self.type = self.AS_LENGTH_H_M
		elif type == "Timestamp":
			self.type = self.TIMESTAMP
		elif str(type).find("Format") != -1:
			self.type = self.FORMAT
			self.fmt_string = type[7:]
		elif type == "AnalogSeconds":
			self.type = self.ANALOG_SEC
		elif type == "AnalogMinutes":
			self.type = self.ANALOG_MIN
		elif type == "AnalogHours":
			self.type = self.ANALOG_HOUR
		else:
			self.type = self.DEFAULT
Example #2
0
 def __init__(self, title):
   namespaces = {
     # own namespaces
     "code-religion" : "http://stats.data-gov.ie/codelist/religion/",
   }
   Converter.__init__(self, DSD, title, namespaces, ED_FILE, EA_FILE)
   self.setAppendedDimensions([
     self.ns["prop"]["religion"],
   ])
   
   self.religionIndexToConcept = [
     {
       "notation" : "catholic",
       "uri" : self.ns["code-religion"]["catholic"],
     },
     {
       "notation" : "other",
       "uri" : self.ns["code-religion"]["other"],
     },
     {
       "notation" : "non",
       "uri" : self.ns["code-religion"]["non"],
     },
     {
       "notation" : "not-stated",
       "uri" : self.ns["code-religion"]["not-stated"],
     },
     {
       "notation" : "total",
       "uri" : self.ns["code-religion"]["total"],
     },
   ]
Example #3
0
 def __init__(self, type):
     Converter.__init__(self, type)
     self.percentlist = []
     self.pfmt = '%3d%%'
     if not type or type == 'Total':
         self.type = self.CPU_TOTAL
         self.sfmt = '$0'
     elif len(type) == 1 and type[0].isdigit():
         self.type = int(type)
         self.sfmt = '$' + type
         self.pfmt = '%d'
     else:
         self.type = self.CPU_ALL
         self.sfmt = str(type)
         cpus = cpuUsageMonitor.getCpusCount()
         if cpus > -1:
             pos = 0
             while True:
                 pos = self.sfmt.find('$', pos)
                 if pos == -1:
                     break
                 if pos < len(self.sfmt) - 1 and self.sfmt[pos + 1].isdigit(
                 ) and int(self.sfmt[pos + 1]) > cpus:
                     self.sfmt = self.sfmt.replace('$' + self.sfmt[pos + 1],
                                                   'n/a')
                 pos += 1
Example #4
0
 def __init__(self, type):
     Poll.__init__(self)
     Converter.__init__(self, type)
     args = type.split(',')
     type = args.pop(0)
     self.negate = 'Negate' in args
     self.detailed = 'Detailed' in args
     self.showHours = 'ShowHours' in args
     self.showNoSeconds = 'ShowNoSeconds' in args
     if type == 'Length':
         self.type = self.TYPE_LENGTH
     elif type == 'Position':
         self.type = self.TYPE_POSITION
     elif type == 'Remaining':
         self.type = self.TYPE_REMAINING
     elif type == 'Gauge':
         self.type = self.TYPE_GAUGE
     elif type == 'EndTime':
         self.type = self.TYPE_ENDTIME
     else:
         raise ElementError('type must be {Length|Position|Remaining|Gauge|EndTime} with optional arguments {Negate|Detailed|ShowHours|ShowNoSeconds} for SCServicePosition converter')
     if self.detailed:
         self.poll_interval = 100
     elif self.TYPE_ENDTIME:
         self.poll_interval = 1000
     elif self.type == self.TYPE_LENGTH:
         self.poll_interval = 2000
     else:
         self.poll_interval = 500
     self.poll_enabled = True
	def __init__(self, type):
		Converter.__init__(self, type)
		self.fix = ''
		if ';' in type:
			(type, self.fix,) = type.split(';')
		if type == 'WithSeconds':
			self.type = self.WITH_SECONDS
		elif type == 'InMinutes':
			self.type = self.IN_MINUTES
		elif type == 'Date':
			self.type = self.DATE
		elif type == 'AsLength':
			self.type = self.AS_LENGTH
		elif type == 'AsLengthHours':
			self.type = self.AS_LENGTHHOURS
		elif type == 'AsLengthSeconds':
			self.type = self.AS_LENGTHSECONDS
		elif type == 'Timestamp':
			self.type = self.TIMESTAMP
		elif type == 'Full':
			self.type = self.FULL
		elif type == 'ShortDate':
			self.type = self.SHORT_DATE
		elif type == 'LongDate':
			self.type = self.LONG_DATE
		elif type == 'VFD':
			self.type = self.VFD
		elif type == 'FullDate':
			self.type = self.FULL_DATE
		elif 'Format' in type:
			self.type = self.FORMAT
			self.fmt_string = type[7:]
		else:
			self.type = self.DEFAULT
Example #6
0
	def __init__(self, type):
		Converter.__init__(self, type)
		Poll.__init__(self)
		self.poll_interval = 30000
		self.poll_enabled = True
		if type == "REF":
			self.type = self.REF
		elif type == "IP":
			self.type = self.IP
		elif type == "NAME":
			self.type = self.NAME
		elif type == "ENCODER":
			self.type = self.ENCODER
		elif type == "NUMBER":
			self.type = self.NUMBER
		elif type == "SHORT_ALL":
			self.type = self.SHORT_ALL
		elif type == "ALL":
			self.type = self.ALL
		elif type == "INFO":
			self.type = self.INFO
		elif type == "INFO_RESOLVE":
			self.type = self.INFO_RESOLVE
		elif type == "INFO_RESOLVE_SHORT":
			self.type = self.INFO_RESOLVE_SHORT
		elif type == "EXTRA_INFO":
			self.type = self.EXTRA_INFO
		else:
			self.type = self.UNKNOWN

		self.streamServer = eStreamServer.getInstance()
Example #7
0
	def __init__(self, type):
		Converter.__init__(self, type)
		
		self.short_list = True
		self.cpu_count = 0
		self.prev_info = self.getCpuInfo(self.CPU_CALC)
		
		if type == "Total":
			self.type = self.CPU_TOTAL
			self.sfmt = "CPU: $0"
		elif not type:
			self.type = self.CPU_TOTAL
			self.sfmt = "$0"
		else:
			self.type = self.CPU_ALL
			self.sfmt = txt = str(type)
			pos = 0
			while True:
				pos = self.sfmt.find("$", pos)
				if pos == -1: break
				if pos < len(self.sfmt)-1 and self.sfmt[pos+1].isdigit():
					x = int(self.sfmt[pos+1])
					if x > self.cpu_count:
						self.sfmt = self.sfmt.replace("$" + self.sfmt[pos+1], "n/a")
				pos += 1
		
		self.curr_info = self.getCpuInfo(self.type)
		
		Poll.__init__(self)
		self.poll_interval = 500
		self.poll_enabled = True
Example #8
0
	def __init__(self, argstr):
		Converter.__init__(self, argstr)
		args = argstr.split(',')
		self.argerror = False
		self.checkSourceBoolean = False
		self.invert = False
		self.configKey = None
		self.configValue = None
		if len(args) < 2:
			self.argerror = True
		else:
			if args[0].find("config.") != -1:
				self.configKey = args[0]
				self.configValue = args[1]
				if len(args) > 2:
					if args[2] == 'Invert':
						self.invert = True
					elif args[2] == 'CheckSourceBoolean':
						self.checkSourceBoolean = True
					else:
						self.argerror = True
				if len(args) > 3:
					if args[3] == 'Invert':
						self.invert = True
					elif args[3] == 'CheckSourceBoolean':
						self.checkSourceBoolean = True
					else:
						self.argerror = True
			else:
				self.argerror = True
		if self.argerror:
			print "ConfigEntryTest Converter got incorrect arguments", args, "!!!\narg[0] must start with 'config.',\narg[1] is the compare string,\narg[2],arg[3] are optional arguments and must be 'Invert' or 'CheckSourceBoolean'"
Example #9
0
	def __init__(self, type):
		Converter.__init__(self, type)
		if type == "WithSeconds":
			self.type = self.WITH_SECONDS
		elif type == "InMinutes":
			self.type = self.IN_MINUTES
		elif type == "Date":
			self.type = self.DATE
		elif type == "AsLength":
			self.type = self.AS_LENGTH
		elif type == "AsLengthHours":
			self.type = self.AS_LENGTHHOURS
		elif type == "AsLengthSeconds":
			self.type = self.AS_LENGTHSECONDS
		elif type == "Timestamp":
			self.type = self.TIMESTAMP
		elif type == "Full":
			self.type = self.FULL
		elif type == "ShortDate":
			self.type = self.SHORT_DATE
		elif type == "LongDate":
			self.type = self.LONG_DATE
		elif type == "FullDate":
			self.type = self.FULL_DATE
		elif type == "VFD":
			self.type = self.VFD
		elif "Format" in type:
			self.type = self.FORMAT
			self.fmt_string = type[7:]
		else:
			self.type = self.DEFAULT
 def changed(self, what):
     Converter.changed(self, what)
     if self.type == self.PROGRESS and len(self.downstream_elements):
         if not self.source.event and self.downstream_elements[0].visible:
             self.downstream_elements[0].visible = False
         elif self.source.event and not self.downstream_elements[0].visible:
             self.downstream_elements[0].visible = True
Example #11
0
	def __init__(self, type):
		Converter.__init__(self, type)
		if type == "WithSeconds":
			self.type = self.WITH_SECONDS
		elif type == "InMinutes":
			self.type = self.IN_MINUTES
		elif type == "Date":
			self.type = self.DATE
		elif type == "AsLength":
			self.type = self.AS_LENGTH
		elif type == "AsLengthHours":
			self.type = self.AS_LENGTHHOURS
		elif type == "AsLengthSeconds":
			self.type = self.AS_LENGTHSECONDS
		elif type == "Timestamp":	
			self.type = self.TIMESTAMP
		elif type == "Full":
			self.type = self.FULL
		elif type == "ShortDate":
			self.type = self.SHORT_DATE
		elif type == "LongDate":
			self.type = self.LONG_DATE
		elif type == "VFD":
			self.type = self.VFD
		elif "Format" in type:
			self.type = self.FORMAT
			self.fmt_string = type[7:]
		else:
			self.type = self.DEFAULT
Example #12
0
	def __init__(self, argstr):
		Converter.__init__(self, argstr)
		args = argstr.split(',')
		self.argerror = False
		self.checkSourceBoolean = False
		self.invert = False
		self.configKey = None
		self.configValue = None
		if len(args) < 2:
			self.argerror = True
		else:
			if "config." in args[0]:
				self.configKey = args[0]
				self.configValue = args[1]
				if len(args) > 2:
					if args[2] == 'Invert':
						self.invert = True
					elif args[2] == 'CheckSourceBoolean':
						self.checkSourceBoolean = True
					else:
						self.argerror = True
				if len(args) > 3:
					if args[3] == 'Invert':
						self.invert = True
					elif args[3] == 'CheckSourceBoolean':
						self.checkSourceBoolean = True
					else:
						self.argerror = True
			else:
				self.argerror = True
		if self.argerror:
			print "ConfigEntryTest Converter got incorrect arguments", args, "!!!\narg[0] must start with 'config.',\narg[1] is the compare string,\narg[2],arg[3] are optional arguments and must be 'Invert' or 'CheckSourceBoolean'"
Example #13
0
    def __init__(self, type):
        Converter.__init__(self, type)

        self.percentlist = []
        self.pfmt = "%3d%%"
        if not type or type == "Total":
            self.type = self.CPU_TOTAL
            self.sfmt = "$0"
        elif len(type) == 1 and type[0].isdigit():
            self.type = int(type)
            self.sfmt = "$" + type
            self.pfmt = "%d"
        else:
            self.type = self.CPU_ALL
            self.sfmt = str(type)
            cpus = cpuUsageMonitor.getCpusCount()
            if cpus > -1:
                pos = 0
                while True:
                    pos = self.sfmt.find("$", pos)
                    if pos == -1: break
                    if pos < len(self.sfmt)-1 and \
                       self.sfmt[pos+1].isdigit() and \
                       int(self.sfmt[pos+1]) > cpus:
                        self.sfmt = self.sfmt.replace("$" + self.sfmt[pos + 1],
                                                      "n/a")
                    pos += 1
Example #14
0
 def __init__(self, type):
     Converter.__init__(self, type)
     self.type = self.UPPER
     if type == 'ToLower':
         self.type = self.LOWER
     elif type == 'ToUpper':
         self.type = self.UPPER
Example #15
0
 def __init__(self, title):
   namespaces = {
     "sdmx-code" : "http://purl.org/linked-data/sdmx/2009/code#",
     # Our namespaces
     "code-age1" : "http://stats.data-gov.ie/codelist/age1/",
   }
   Converter.__init__(self, DSD, title, namespaces, ED_FILE, EA_FILE)
   self.setAppendedDimensions([
     self.ns["sdmx-dimension"]["sex"],
     self.ns["prop"]["age1"],
   ])
   self.sexIndexToConcept = [
     {
       "notation" : "T",
       "uri" : self.ns["sdmx-code"]["sex-T"],
     },
     {
       "notation" : "M",
       "uri" : self.ns["sdmx-code"]["sex-M"],
     },
     {
       "notation" : "F",
       "uri" : self.ns["sdmx-code"]["sex-F"],
     },
   ]
Example #16
0
    def __init__(self, type):
        Converter.__init__(self, type)
        self.separator = ' - '
        self.formats = []
        type = type.lstrip()
        if type[0:5] == 'Parse':
            parse = type[5:6]
        else:
            parse = ';'
            if type[0:6] != 'Format':
                type = type.replace(',', ';')
        args = [arg.lstrip() for arg in type.split(parse)]
        for arg in args:
            if arg[0:6] == 'Format':
                self.formats.append(
                    eval('lambda t: strftime("%s", localtime(t))' % arg[7:]))
                continue
            if arg[0:7] == 'NoSpace':
                continue
            if arg[0:5] == 'Parse':
                continue
            if arg[0:12] == 'Proportional':
                continue
            if arg[0:9] == 'Separator':
                self.separator = arg[10:]
                continue
            self.formats.append(self.TIME_OPTIONS.get(arg, lambda t: '???'))

        if len(self.formats) == 0:
            self.formats.append(
                self.TIME_OPTIONS.get('Default', lambda t: '???'))
Example #17
0
	def __init__(self, type):
		Converter.__init__(self, type)
		Poll.__init__(self)
		self.poll_interval = 30000
		self.poll_enabled = True
		if type == "REF":
			self.type = self.REF
		elif type == "IP":
			self.type = self.IP
		elif type == "NAME":
			self.type = self.NAME
		elif type == "ENCODER":
			self.type = self.ENCODER
		elif type == "NUMBER":
			self.type = self.NUMBER
		elif type == "SHORT_ALL":
			self.type = self.SHORT_ALL
		elif type == "ALL":
			self.type = self.ALL
		elif type == "INFO":
			self.type = self.INFO
		elif type == "INFO_RESOLVE":
			self.type = self.INFO_RESOLVE
		elif type == "INFO_RESOLVE_SHORT":
			self.type = self.INFO_RESOLVE_SHORT
		else:
			self.type = self.UNKNOWN

		self.streamServer = eStreamServer.getInstance()
Example #18
0
	def __init__(self, type):
		Converter.__init__(self, type)
		self.type = self.UPPER
		if type == "ToLower":
			self.type = self.LOWER
		elif type == "ToUpper":
			self.type = self.UPPER
	def __init__(self, type):
		Converter.__init__(self, type)
		Poll.__init__(self)
		if type == "Background":
			self.type = self.PROGRESSBACKROUND
			self.poll_interval = 30*1000
			self.poll_enabled = True
	def __init__(self, type):
		Converter.__init__(self, type)
		if type == "WithSeconds":
			self.type = self.WITH_SECONDS
		elif type == "InMinutes":
			self.type = self.IN_MINUTES
		elif type == "InStunden":
			self.type = self.STUNDEN
		elif type == "Date":
			self.type = self.DATE
		elif type == "AsLength":
			self.type = self.AS_LENGTH
		elif type == "Timestamp":	
			self.type = self.TIMESTAMP
		elif str(type).find("Format") != -1:
			self.type = self.FORMAT
			self.fmt_string = type[7:]
		elif str(type).find("LocaleKurz") != -1:
			self.type = self.LOCDE
			self.fmt_string = type[11:]
		elif str(type).find("LocaleLang") != -1:
			self.type = self.LOCFULL
			self.fmt_string = type[11:]
		else:
			self.type = self.DEFAULT
		if config.osd.language.value == "de_DE":
			self.Tage = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"]
			self.Monate = ["Jan", "Feb", u"M\xe4r", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]
		elif (config.osd.language.value == "it_IT") or (config.osd.language.value == "es_ES"):
			self.Tage = ["Lu", "Ma", "Me", "Gi", "Ve", "Sa", "Do"]
			self.Monate = ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"]
		else:
			self.Tage = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]
			self.Monate = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
	def __init__(self, type):
		Converter.__init__(self, type)
		if type == "WithSeconds":
			self.type = self.WITH_SECONDS
		elif type == "InMinutes":
			self.type = self.IN_MINUTES
		elif type == "InStunden":
			self.type = self.STUNDEN
		elif type == "Date":
			self.type = self.DATE
		elif type == "AsLength":
			self.type = self.AS_LENGTH
		elif type == "Timestamp":
			self.type = self.TIMESTAMP
		elif str(type).find("Format") != -1:
			self.type = self.FORMAT
			self.fmt_string = type[7:]
		elif str(type).find("LocaleKurz") != -1:
			self.type = self.LOCDE
			self.fmt_string = type[11:]
		elif str(type).find("LocaleLang") != -1:
			self.type = self.LOCFULL
			self.fmt_string = type[11:]
		else:
			self.type = self.DEFAULT
		if config.osd.language.value == "de_DE":
			self.Tage = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"]
			self.Monate = ["Jan", "Feb", u"M\xe4r", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]
		elif (config.osd.language.value == "it_IT") or (config.osd.language.value == "es_ES"):
			self.Tage = ["Lu", "Ma", "Me", "Gi", "Ve", "Sa", "Do"]
			self.Monate = ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"]
		else:
			self.Tage = ["Mo", "Tu", "We", "Th", "Fr", "Say", "Su"]
			self.Monate = ["Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
 def __init__(self, title):
   namespaces = {
     # own namespaces
     "code-residence" : "http://stats.data-gov.ie/codelist/usual-residence/",
   }
   Converter.__init__(self, DSD, title, namespaces, ED_FILE, EA_FILE)
   
   self.setAppendedDimensions([
     self.ns["prop"]["usualResidence"],
   ])
   
   self.usualResidenceIndexToConcept = [
     {
       "notation" : "same-address",
       "uri" : self.ns["code-residence"]["same-address"],
     },
     {
       "notation" : "elsewhere-in-county",
       "uri" : self.ns["code-residence"]["elsewhere-in-county"],
     },
     {
       "notation" : "elsewhere-in-ireland",
       "uri" : self.ns["code-residence"]["elsewhere-in-ireland"],
     },
     {
       "notation" : "outside-ireland",
       "uri" : self.ns["code-residence"]["outside-ireland"],
     },
     {
       "notation" : "total",
       "uri" : self.ns["code-residence"]["total"],
     },
   ]
Example #23
0
	def __init__(self, type):
		Converter.__init__(self, type)
		self.separator = " - "
		self.formats = []

		buffer = type.lstrip()
		if buffer[0:5] == "Parse":
			parse = buffer[5:6]
		else:
			buffer.replace(';', ',')  # Some builds use ";" as a separator, most use ",".  If "Parse" is NOT used change ";" to "," and parse on ",".
			parse = ","

		args = [arg.lstrip() for arg in type.split(parse)]
		for arg in args:
			if arg[0:6] == "Format":
				self.formats.append(lambda t: strftime(arg[7:], localtime(t)))
				continue
			if arg[0:7] == "NoSpace":
				# Eat old OpenVIX option as it doesn't make sense now.
				continue
			if arg[0:5] == "Parse":
				# Already processed.
				continue
			if arg[0:12] == "Proportional":
				# Eat old OpenVIX option as it doesn't make sense now.
				continue
			if arg[0:9] == "Separator":
				self.separator = arg[10:]
				continue
			self.formats.append(self.TIME_OPTIONS.get(arg, lambda t: "???"))
		if len(self.formats) == 0:
			self.formats.append(self.TIME_OPTIONS.get("Default", lambda t: "???"))
Example #24
0
 def __init__(self, type):
     Converter.__init__(self, type)
     Poll.__init__(self)
     if type == "EndTime":
         self.type = self.ENDTIME
     elif type == "Remaining":
         self.type = self.REMAINING
         self.poll_interval = 60 * 1000
         self.poll_enabled = True
     elif type == "StartTime":
         self.type = self.STARTTIME
     elif type == "Duration":
         self.type = self.DURATION
     elif type == "Progress":
         self.type = self.PROGRESS
         self.poll_interval = 30 * 1000
         self.poll_enabled = True
     elif type == "RunTime":
         self.type = self.RUNTIME
         self.poll_interval = 1 * 1000
         self.poll_enabled = True
     else:
         raise ElementError(
             "'%s' is not <StartTime|EndTime|Remaining|Duration|Progress|Runtime> for fenrisEventTime converter"
             % type)
	def changed(self, what):
		Converter.changed(self, what)
		if self.type is self.PROGRESS and len(self.downstream_elements):
			if not self.source.event and self.downstream_elements[0].visible:
				self.downstream_elements[0].visible = False
			elif self.source.event and not self.downstream_elements[0].visible:
				self.downstream_elements[0].visible = True
Example #26
0
	def __init__(self, type):
		Converter.__init__(self, type)
		
		self.percentlist = [ ]
		self.pfmt = "%3d%%"
		if not type or type == "Total":
			self.type = self.CPU_TOTAL
			self.sfmt = "$0"
		elif len(type) == 1 and type[0].isdigit():
			self.type = int(type)
			self.sfmt = "$" + type
			self.pfmt = "%d"
		else:
			self.type = self.CPU_ALL
			self.sfmt = str(type)
			cpus = cpuUsageMonitor.getCpusCount()
			if cpus > -1:
				pos = 0
				while True:
					pos = self.sfmt.find("$", pos)
					if pos == -1: break
					if pos < len(self.sfmt)-1 and \
					   self.sfmt[pos+1].isdigit() and \
					   int(self.sfmt[pos+1]) > cpus:
						self.sfmt = self.sfmt.replace("$" + self.sfmt[pos+1], "n/a")
					pos += 1
Example #27
0
	def __init__(self, type):
		Poll.__init__(self)
		Converter.__init__(self, type)

		args = type.split(',')
		type = args.pop(0)

		self.negate = 'Negate' in args
		self.plus = 'Plus' in args
		self.detailed = 'Detailed' in args
		self.showHours = 'ShowHours' in args
		self.showNoSeconds = 'ShowNoSeconds' in args

		if type == "Length":
			self.type = self.TYPE_LENGTH
		elif type == "Position":
			self.type = self.TYPE_POSITION
		elif type == "Remaining":
			self.type = self.TYPE_REMAINING
		elif type == "Gauge":
			self.type = self.TYPE_GAUGE
		elif type == "Summary":
			self.type = self.TYPE_SUMMARY
		else:
			raise ElementError("type must be {Length|Position|Remaining|Gauge} with optional arguments {Negate|Detailed|ShowHours|ShowNoSeconds} for ServicePosition converter")

		if self.detailed:
			self.poll_interval = 100
		elif self.type == self.TYPE_LENGTH:
			self.poll_interval = 2000
		else:
			self.poll_interval = 500

		self.poll_enabled = True
Example #28
0
 def __init__(self, type):
     Converter.__init__(self, type)
     Poll.__init__(self)
     if type == 'volume':
         self.type = self.VOLUMEN
         self.poll_interval = 100
         self.poll_enabled = True
Example #29
0
    def testGetIdByName_10_NumName_ZeroParams(self):
        converter = Converter()
        for i in range(10):
            converter.addQuantities(str(i), [0] * i)

        for i in range(20):
            baseName = random.randint(0, 9)
            self.assertEqual(baseName, converter.getIdByName(str(baseName)))
Example #30
0
 def __init__(self, argstr):
     Converter.__init__(self, argstr)
     args = argstr.split(',')
     self.invert = "Invert" in args
     self.blink = "Blink" in args
     if self.blink:
         self.blinktime = 500
     self.timer = None
Example #31
0
 def __init__(self, argstr):
     Converter.__init__(self, argstr)
     Poll.__init__(self)
     self.poll_interval = 120000
     self.poll_enabled = True
     self.recordings = False
     self.type = 0
     debugtxt('inicio')
	def __init__(self, type):
		Poll.__init__(self)
		Converter.__init__(self, type)
		self.mainstream = None
		self.sourceList = [ ]
		self.sourceIndex = -1
		if type and type.isdigit():
			self.poll_interval = int(type) * 1000
Example #33
0
 def __init__(self, type):
     Poll.__init__(self)
     Converter.__init__(self, type)
     self.mainstream = None
     self.sourceList = []
     self.sourceIndex = -1
     if type and type.isdigit():
         self.poll_interval = int(type) * 1000
 def __init__(self, lim=946, iteraciones=100):
     self.converter = Converter(lim)
     self.indices = self.converter.getIndices()
     self.data = self.converter.formater()
     self.label_encoder = LabelEncoder()
     self.datos, self.delta = self.data
     self.iteraciones = iteraciones
     self.codificar()
Example #35
0
	def __init__(self, argstr):
		Converter.__init__(self, argstr)
		args = argstr.split(',')
		self.invert = "Invert" in args
		self.blink = "Blink" in args
		if self.blink:
			self.blinktime = 500
		self.timer = None
Example #36
0
def convert_from_file(filename):
    converter = Converter()
    with open(filename, "r")as f:
        lines = [line.rstrip() for line in f.readlines()]
    from_currency = lines[0]
    to_currency = lines[1]
    for ammount in lines[2:]:
        print(converter.convert(from_currency, to_currency, float(ammount)))
Example #37
0
 def __init__(self):
     super().__init__()
     self.setupUi(self)
     self.__converter = Converter()
     self.__arrAddQuant = [0] * (len(self.__converter.getQuantities()))
     self.addQuant.clicked.connect(self.addQuantity)
     self.addQuant_2.clicked.connect(self.addArrQuant)
     self.MakeConv.clicked.connect(self.makeConvert)
Example #38
0
 def __init__(self, argstr):
     Converter.__init__(self, argstr)
     Poll.__init__(self)
     self.poll_interval = 120000
     self.poll_enabled = True
     self.recordings = False
     self.type = 0
     debugtxt('inicio')
Example #39
0
 def __init__(self, type):
     Converter.__init__(self, type)
     self.LastRotorPos = config.misc.lastrotorposition.value
     config.misc.lastrotorposition.addNotifier(self.forceChanged,
                                               initial_call=False)
     config.misc.showrotorposition.addNotifier(self.show_hide,
                                               initial_call=False)
     self.sec = eDVBSatelliteEquipmentControl.getInstance()
    def __init__(self, type):
        Converter.__init__(self, type)
        Poll.__init__(self)

        if type == "volume":
            self.type = self.VOLUMEN
            self.poll_interval = 100
            self.poll_enabled = True
Example #41
0
	def __init__(self, type):
		Converter.__init__(self, type)

		self.type = type
		self.fix = ""
		if ";" in type:
			type, self.fix = type.split(";")
		if "Format" in type:
			self.fmt_string = type[7:]
Example #42
0
    def testMainDiadQuant100_EmptyName_randomList(self):
        converter = Converter()
        size = 100
        for i in range(size):
            listAdd = [random.randint(0, 100)] * (i)
            converter.addQuantities("", listAdd)

            self.assertEqual(1,
                             converter.getQuantities()[i][i],
                             "quant diag should be 1")
Example #43
0
	def __init__(self, type):
		Converter.__init__(self, type)
		if type == "Seconds":
			self.type = self.OMA_SEC
		elif type == "Minutes":
			self.type = self.OMA_MIN
		elif type == "Hours":
			self.type = self.OMA_HOUR
		else:
			self.type = self.DEFAULT
Example #44
0
 def __init__(self, type):
     Converter.__init__(self, type)
     if type == 'Seconds':
         self.type = self.OMA_SEC
     elif type == 'Minutes':
         self.type = self.OMA_MIN
     elif type == 'Hours':
         self.type = self.OMA_HOUR
     else:
         self.type = self.DEFAULT
Example #45
0
	def __init__(self, type):
		Converter.__init__(self, type)
		if type == "EndTime":
			self.type = self.ENDTIME
		elif type == "StartTime":
			self.type = self.STARTTIME
		elif type == "Duration":
			self.type = self.DURATION
		else:
			raise ElementError("'%s' is not <StartTime|EndTime|Duration> for ServiceTime converter" % type)
Example #46
0
 def __init__(self, type):
     Converter.__init__(self, type)
     if type == 'Seconds':
         self.type = self.OMA_SEC
     elif type == 'Minutes':
         self.type = self.OMA_MIN
     elif type == 'Hours':
         self.type = self.OMA_HOUR
     else:
         self.type = self.DEFAULT
Example #47
0
	def connectDownstream(self, downstream):
		Converter.connectDownstream(self, downstream)
		vis = self.calcVisibility()
		if self.blink:
			if vis:
				self.startBlinking()
			else:
				self.stopBlinking()
		else:
			downstream.visible = self.calcVisibility()
Example #48
0
	def __init__(self, type):
		Converter.__init__(self, type)
		if type == "EndTime":
			self.type = self.ENDTIME
		elif type == "StartTime":
			self.type = self.STARTTIME
		elif type == "Duration":
			self.type = self.DURATION
		else:
			raise ElementError("'%s' is not <StartTime|EndTime|Duration> for ServiceTime converter" % type)
Example #49
0
 def connectDownstream(self, downstream):
     Converter.connectDownstream(self, downstream)
     vis = self.calcVisibility()
     if self.blink:
         if vis:
             self.startBlinking()
         else:
             self.stopBlinking()
     else:
         downstream.visible = self.calcVisibility()
Example #50
0
 def __init__(self, type):
     Converter.__init__(self, type)
     if type == "Seconds":
         self.type = self.OMA_SEC
     elif type == "Minutes":
         self.type = self.OMA_MIN
     elif type == "Hours":
         self.type = self.OMA_HOUR
     else:
         self.type = self.DEFAULT
Example #51
0
	def __init__(self, argstr):
		Converter.__init__(self, argstr)
		args = argstr.split(',')
		self.invert = "Invert" in args
		self.blink = "Blink" in args
		if self.blink:
			self.blinktime = 500
			self.timer = eTimer()
			self.timer.callback.append(self.blinkFunc)
		else:
			self.timer = None
Example #52
0
 def Run_Analysis(self):
     CreateDirectoryIfNecessary(self.settings.output_dir + '/' +
                                self.settings.sub_dir + '/' +
                                str(self.settings.run))
     self.converter = Converter(self.settings)
     if self.converter.do_conversion:
         self.converter.Convert()
     self.pedestals = PedestalCalculations(self.settings)
     if self.pedestals.do_pedestal_calculations:
         # self.pedestals.CalculatePedestals()
         self.pedestals.CalculateDevicesPedestals2()
Example #53
0
 def __init__(self, argstr):
     Converter.__init__(self, argstr)
     args = argstr.split(',')
     self.invert = "Invert" in args
     self.blink = "Blink" in args
     if self.blink:
         self.blinktime = 500
         self.timer = eTimer()
         self.timer.callback.append(self.blinkFunc)
     else:
         self.timer = None
Example #54
0
	def __init__(self, argstr):
		Converter.__init__(self, argstr)
		args = argstr.split(',')
		self.invert = "Invert" in args
		self.blink = "Blink" in args
		if self.blink:
			self.blinktime = len(args) == 2 and args[1].isdigit() and int(args[1]) or 500
			self.timer = eTimer()
			self.timer.callback.append(self.blinkFunc)
		else:
			self.timer = None
	def __init__(self, argstr):
		Converter.__init__(self, argstr)
		args = argstr.split(',')
		self.invert = "Invert" in args
		self.blink = "Blink" in args
		if self.blink:
			self.blinktime = len(args) == 2 and args[1].isdigit() and int(args[1]) or 500
			self.timer = eTimer()
			self.timer.callback.append(self.blinkFunc)
		else:
			self.timer = None
Example #56
0
    def __init__(self, type):
        Converter.__init__(self, type)
        Poll.__init__(self)
        if type == "free":
            self.type = self.free
        elif type == "size":
            self.type = self.size
        elif type == "path":
            self.type = self.path

        self.poll_interval = 2000
        self.poll_enabled = True
def functionality1(image_name: str, plot):
    image_data = ImageData("images\\" + image_name)

    y, i, q = Converter().rgb_to_yiq(image_data.get_matrix_red(),
                                     image_data.get_matrix_green(),
                                     image_data.get_matrix_blue())
    r, g, b = Converter().yiq_to_rgb(y, i, q)

    image_data.set_rgb_from_matrices(r, g, b)
    new_image_path = image_data.save_image(
        new_file_name_suffix='(rgb-yiq-rgb)')
    show_image(new_image_path, plot)
Example #58
0
    def __init__(self, type):
        Converter.__init__(self, type)
        Poll.__init__(self)
        if type == "free":
            self.type = self.free
        elif type == "size":
            self.type = self.size
        elif type == "path":
            self.type = self.path

        self.poll_interval = 2000
        self.poll_enabled = True
Example #59
0
	def connectDownstream(self, downstream):
		Converter.connectDownstream(self, downstream)
		vis = self.calcVisibility()

		if self.blink:
			if not downstream.canPulsate():
				self.timer = eTimer()
				self.timer_conn = self.timer.timeout.connect(self.blinkFunc)
			if vis:
				self.startBlinking()
			else:
				self.stopBlinking()
		else:
			downstream.visible = self.calcVisibility()