################################################################################ # # # Folding@Home Client Control (FAHControl) # # Copyright (C) 2016-2020 foldingathome.org # # Copyright (C) 2010-2016 Stanford University # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # # # ################################################################################ # fah.util import sys import os import gtk from SingleApp import * from EntryValidator import * from PasswordValidator import * from OrderedDict import * from PYONDecoder import * def parse_bool(x): if isinstance(x, bool): return x return x.lower() in ['true', 't', '1', 'yes', 'y'] def status_to_color(status): status = status.upper() if status == 'PAUSED' or status == 'UPDATING': return '#ffff55' elif status == 'FINISHED' or status == 'OFFLINE' or status == 'UPLOADED': return '#0080c0' elif status == 'RUNNING' or status == 'ACTIVE' or status == 'ONLINE': return '#1dd923' elif status == 'FINISHING': return '#7AD980' elif status == 'FAILED' or status == 'ERROR' or status == 'FAULTY': return '#ff0000' elif status == 'SHUTDOWN' or status == 'CONNECTING': return '#ff8b00' elif status == 'OFFLINE': return '#dddddd' elif status == 'READY': return '#1ef0bc' elif status == 'DUMP': return '#d2c272' else: return None def get_span_markup(text, bg = None, fg = 'black'): markup = '