示例#1
0
    def vldt_time(self):

        # Validate each timestamp.  Assume that each value is valid
        # unless it "is None".

        self.vld_strt = False if (self.time_strt is None) else True
        self.vld_stop = False if (self.time_stop is None) else True

        # Validate the range specified by the timestamps.  The range is
        # valid only if each of the individual timestamps is itself
        # valid and the stop timestamp occurs after the start timestamp.

        if ((self.vld_strt) and (self.vld_stop)):

            if (self.time_stop >= self.time_strt):
                self.vld_rang = True
            else:
                self.vld_rang = False

        else:

            self.vld_rang = False

        # For any valid timestamp, standardize the text shown in its
        # corresponding text box.

        if (self.vld_strt):
            self.txt_strt.setTextUpdate(calc_time_sec(self.time_strt))

        if (self.vld_stop):
            self.txt_stop.setTextUpdate(calc_time_sec(self.time_stop))

        # Update the text color of each text box to indicate the
        # validity of it's contents.

        if ((self.vld_strt) and (self.vld_stop)):

            if (self.vld_rang):
                self.txt_strt.setStyleSheet('color: black;')
                self.txt_stop.setStyleSheet('color: black;')
            else:
                self.txt_strt.setStyleSheet('color: red;')
                self.txt_stop.setStyleSheet('color: red;')
        else:

            if ((self.vld_strt) or (str(self.txt_strt.text()) == '')):
                self.txt_strt.setStyleSheet('color: black;')
            else:
                self.txt_strt.setStyleSheet('color: red;')

            if ((self.vld_stop) or (str(self.txt_stop.text() == ''))):
                self.txt_stop.setStyleSheet('color: black;')
            else:
                self.txt_stop.setStyleSheet('color: red;')
示例#2
0
def make_name( core ) :

	# Initialize the string to be returned.

	name = 'janus'


	# If the provided core has no results, return the file name as is.

	if ( len( core.series ) == 0 ) :

		return name

	# Retrieve the earliest and latest timestamps in the results of the
	# provided core, convert each to a string, and reformat each string.

	t1 = calc_time_sec( min( core.series['time'] ) )
	t2 = calc_time_sec( max( core.series['time'] ) )

	t1 = t1[0:10] + '-' + t1[11:13] + '-' + t1[14:16] + '-' + t1[17:19]
	t2 = t2[0:10] + '-' + t2[11:13] + '-' + t2[14:16] + '-' + t2[17:19]

	# Append the first timestamp to the file name.

	name += '_' + t1

	# If the provided coe only has only a signle result, return the file
	# name as is.

	if ( len( core.series ) == 1 ) :

		return name

	# Append the second timestamp to the file name.

	name += '_' + t2

	# Return the file name.

	return name
示例#3
0
    def aply_time(self,
                  time_strt=None,
                  time_stop=None,
                  get_next=None,
                  err_halt=None):

        # For each timestamp for which a new value was specified, apply
        # that new value.

        for (bx, tm) in [(self.txt_strt, time_strt),
                         (self.txt_stop, time_stop)]:

            # If no new value was specified for this timestamp, more
            # onto the next one.

            if (tm is None):
                continue

            # Convert the new timestamp value into a string
            # (accurate to the second).

            tm_str = calc_time_sec(tm)

            tm_str = '' if (tm_str is None) else tm_str

            # Update the corresponding text box with the string
            # generated for the new value.

            bx.setTextUpdate(tm_str)

        # If requested, update the state of the checkbox(es).

        if (get_next is not None):
            self.box_next.setChecked(get_next)

        if (err_halt is not None):
            self.box_halt.setChecked(err_halt)

        # Retrieve (and subsequently validate) the new timestamp
        # value(s).

        self.rtrv_time()