├── INSTALL.md ├── README.md ├── dcload.conf ├── dcload.py ├── dcload_control.py ├── dcload_django ├── __init__.py ├── settings.py ├── urls.py └── wsgi.py ├── dcload_ui ├── __init__.py ├── admin.py ├── models.py ├── tests.py ├── urls.py └── views.py ├── start_django.sh ├── static ├── css │ ├── bootstrap-3.2.0.min.css │ ├── bootstrap.min.css │ ├── chosen.css │ ├── color-buttons.css │ ├── dcload.css │ ├── images │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ └── ui-bg_glass_75_e6e6e6_1x400.png │ ├── jquery-ui.css │ └── stereoui.css ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── icons │ ├── Thumbs_down_32px.png │ ├── Thumbs_up_32px.png │ ├── chosen-sprite.png │ └── chosen-sprite@2x.png └── js │ ├── dcload.js │ └── vendor │ ├── chosen.jquery.js │ ├── jquery-1.9.1.js │ └── jquery-ui.js ├── templates └── dcload_ui │ └── index.html ├── up.sh └── web_server.py /INSTALL.md: -------------------------------------------------------------------------------- 1 | Installation Notes 2 | 3 | ``` 4 | sudo raspi-config 5 | enable spi and i2d 6 | 7 | sudo apt-get update 8 | sudo apt-get -y install python-smbus i2c-tools python-pip 9 | 10 | # install spidev 11 | mkdir python-spi 12 | cd python-spi 13 | wget https://raw.github.com/doceme/py-spidev/master/setup.py 14 | wget https://raw.github.com/doceme/py-spidev/master/spidev_module.c 15 | echo > README.md 16 | echo > CHANGELOG.md 17 | sudo python setup.py install 18 | 19 | # install django 20 | sudo pip install Django==1.7 21 | 22 | # On Pi-Zero-W increase the i2c speed 23 | sudo emacs /boot/config.txt 24 | dtparam=i2c1=on 25 | dtparam=i2c1_baudrate=400000 26 | 27 | # Add to crontab for auto startup 28 | @reboot bash /home/pi/dcload/start_django.sh &> /dev/null 29 | 30 | # Avoid writing to the sd-card 31 | sudo emacs /etc/fstab 32 | tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0 33 | tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30m 0 0 34 | tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=100m 0 0 35 | tmpfs /var/run tmpfs defaults,noatime,nosuid,mode=0755,size=2m 0 0 36 | sudo dphys-swapfile swapoff 37 | sudo dphys-swapfile uninstall 38 | sudo update-rc.d dphys-swapfile remove 39 | 40 | 41 | # DO NOT DO 42 | sudo pip install adafruit-ads1x15 43 | 44 | fix bug in adafruit library: 45 | sudo emacs /usr/local/lib/python2.7/dist-packages/Adafruit_PureIO/smbus.py 46 | cmdstring = create_string_buffer(len(cmd)) 47 | for i, val in enumerate(cmd): 48 | - cmdstring[i] = val 49 | + cmdstring[i] = chr(val) 50 | ``` -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi controlled DCLoad 2 | ## Scott Baker, http://www.smbaker.com/ 3 | 4 | A DCLoad controlled by a raspberry pi. 5 | Uses LCD (or VFD) and encoder as UI. 6 | Plan on using Django as a web UI. 7 | 8 | TODO: Description, Notes, ... 9 | -------------------------------------------------------------------------------- /dcload.conf: -------------------------------------------------------------------------------- 1 | # Defaults for scott's dcload, with 0.5 ohm sense resistor 2 | # Place this file in /etc/dcload.conf 3 | 4 | [defaults] 5 | sense_ohms=0.5 6 | vtrim=1.0044 7 | -------------------------------------------------------------------------------- /dcload.py: -------------------------------------------------------------------------------- 1 | from smbpi.mcp4821 import MCP4821 2 | from smbpi.ads1115 import ADS1115, MUX_AIN0_AIN3, MUX_AIN1_AIN3, PGA_4V, MODE_CONT, DATA_32, COMP_MODE_TRAD, COMP_POL_LOW, COMP_NON_LAT, COMP_QUE_DISABLE 3 | import smbus 4 | import spidev 5 | import sys 6 | import time 7 | 8 | DEFAULT_DACGAIN = 1 9 | DEFAULT_ADCGAIN = 1 10 | DEFAULT_ADCADDR = 0x48 11 | DEFAULT_SENSE_OHMS = 0.1 12 | 13 | 14 | class DCLoad: 15 | def __init__(self, 16 | bus, 17 | spi, 18 | adcAddr=DEFAULT_ADCADDR, 19 | dacGain=DEFAULT_DACGAIN, 20 | adcGain=DEFAULT_ADCGAIN, 21 | senseOhms=DEFAULT_SENSE_OHMS): 22 | self.bus = bus 23 | self.spi = spi 24 | self.adcAddr = adcAddr 25 | self.dacGain = dacGain 26 | self.adcGain = adcGain 27 | self.adcResolution = 32767 # 16-bit, positive half 28 | self.adcVRef = 4096 # in millivolts 29 | self.adcDiv1 = 75000.0 30 | self.adcDiv2 = 1000.0 31 | self.adcOffs = 0 # 55 32 | self.loadResistor = senseOhms 33 | 34 | self.dac = MCP4821(spi, gain=self.dacGain) 35 | self.adc = ADS1115(bus, self.adcAddr) 36 | 37 | def SetDesiredMilliamps(self, ma): 38 | self.dac.SetVoltage(float(ma) * float(self.loadResistor) / 1000.0) 39 | 40 | def GetActualMilliamps(self): 41 | # Note: We use differential mode, because the GND between the vreg and the 42 | # ADC may have some voltage drop. 43 | self.adc.write_config(MUX_AIN0_AIN3 | PGA_4V | MODE_CONT | DATA_32 | COMP_MODE_TRAD | COMP_POL_LOW | COMP_NON_LAT | COMP_QUE_DISABLE) 44 | self.adc.wait_samp() 45 | self.adc.wait_samp() 46 | 47 | v = self.adc.read_conversion() 48 | millivolts = float(v) * float(self.adcVRef) / float(self.adcResolution) + self.adcOffs 49 | 50 | return millivolts/float(self.loadResistor) 51 | 52 | def GetActualVolts(self): 53 | # Note: We use differential mode, because the GND between the vreg and the 54 | # ADC may have some voltage drop. 55 | self.adc.write_config(MUX_AIN1_AIN3 | PGA_4V | MODE_CONT | DATA_32 | COMP_MODE_TRAD | COMP_POL_LOW | COMP_NON_LAT | COMP_QUE_DISABLE) 56 | self.adc.wait_samp() 57 | self.adc.wait_samp() 58 | 59 | v = self.adc.read_conversion() 60 | millivolts = float(v) * float(self.adcVRef) / float(self.adcResolution) + self.adcOffs 61 | 62 | return millivolts * (self.adcDiv1 + self.adcDiv2) / (self.adcDiv2) / 1000.0 63 | 64 | 65 | def main(): 66 | if len(sys.argv)<=1: 67 | print >> sys.stderr, "Please specify milliamps as command-line arg" 68 | sys.exit(-1) 69 | 70 | desired_ma = float(sys.argv[1]) 71 | 72 | bus = smbus.SMBus(1) 73 | spi = spidev.SpiDev() 74 | dcload = DCLoad(bus, spi) 75 | 76 | dcload.SetDesiredMilliamps(desired_ma) 77 | while True: 78 | actual_ma = dcload.GetActualMilliamps() 79 | actual_volts = dcload.GetActualVolts() 80 | print "Desired_ma=%0.4f, Actual_ma=%0.4f, actual_volts=%0.4f \n" % (desired_ma, actual_ma, actual_volts), 81 | time.sleep(0.1) 82 | 83 | 84 | if __name__ == "__main__": 85 | main() 86 | -------------------------------------------------------------------------------- /dcload_control.py: -------------------------------------------------------------------------------- 1 | # DCLoad Controller 2 | # Scott Baker, http://www.smbaker.com 3 | # 4 | # This implements the main control loop and the VFD/LCD user interface 5 | # for the pi-powered dc load. 6 | 7 | import argparse 8 | import ConfigParser 9 | import os 10 | import smbus 11 | import spidev 12 | import sys 13 | import threading 14 | import time 15 | from dcload import DCLoad, DEFAULT_ADCADDR, DEFAULT_DACGAIN, DEFAULT_ADCGAIN 16 | from dcload import DEFAULT_SENSE_OHMS 17 | from smbpi.vfdcontrol import VFDController, trimpad 18 | from smbpi.ioexpand import MCP23017 19 | from smbpi.ds1820 import DS1820 20 | 21 | DEFAULT_VTRIM = 1.0 22 | DEFAULT_ATRIM = 1.0 23 | DEFAULT_CONFIG_FILE = "/etc/dcload.conf" 24 | 25 | # either 20x4 or 16x2 depending on the module 26 | DEFAULT_DISPLAY = "20x4" 27 | DEFAULT_NOCURSOR = True 28 | 29 | 30 | class DCLoad_Control(DCLoad): 31 | def __init__(self, 32 | bus, 33 | spi, 34 | adcAddr=DEFAULT_ADCADDR, 35 | dacGain=DEFAULT_DACGAIN, 36 | adcGain=DEFAULT_ADCGAIN, 37 | senseOhms=DEFAULT_SENSE_OHMS, 38 | display_kind=DEFAULT_DISPLAY, 39 | display_nocursor=DEFAULT_NOCURSOR, 40 | atrim=DEFAULT_ATRIM, 41 | vtrim=DEFAULT_VTRIM): 42 | DCLoad.__init__(self, bus, spi, adcAddr, dacGain, adcGain, senseOhms) 43 | 44 | self.display = VFDController(MCP23017(bus, 0x20), 45 | four_line=(display_kind == "20x4")) 46 | self.display.setDisplay(True, False, False) 47 | self.display_kind = display_kind 48 | self.display_nocursor = display_nocursor 49 | 50 | self.ds = DS1820() 51 | 52 | self.vtrim = vtrim 53 | self.atrim = atrim 54 | self.temperature = 0.0 55 | self.desired_ma = 0 56 | self.actual_ma = 0 57 | self.actual_volts = 0 58 | self.cursor_x = 3 59 | self.last_line = ["", "", "", ""] 60 | self.update_count = 0 61 | 62 | self.new_desired_ma = None 63 | 64 | self.display.set_color(0) 65 | 66 | def start(self): 67 | self.start_thread() 68 | 69 | def update_display_16x2(self): 70 | # turn off cursor 71 | self.display.setDisplay(True, False, False) 72 | 73 | line1 = "A:%6.3f >%6.3f" % (self.desired_ma/1000.0, self.actual_ma/1000.0) 74 | 75 | line2 = "V:%6.3f W:%5.3f" % (self.actual_volts, self.actual_watts) 76 | 77 | self.display.setPosition(0, 0) 78 | self.display.writeStr(trimpad(line1, 16)) 79 | 80 | self.display.setPosition(0, 1) 81 | self.display.writeStr(trimpad(line2, 16)) 82 | 83 | # turn on cursor 84 | if self.cursor_x == 0: 85 | self.display.setPosition(3, 0) 86 | else: 87 | self.display.setPosition(4+self.cursor_x, 0) 88 | self.display.setDisplay(True, True, False) 89 | 90 | def writeLineDelta(self, y, line): 91 | if self.last_line[y] == line: 92 | return 93 | 94 | ll = self.last_line[y] 95 | i = 0 96 | first_diff = None 97 | last_diff = None 98 | while i < len(line): 99 | same = (i < len(ll)) and (line[i] == ll[i]) 100 | if (not same) and (first_diff is None): 101 | first_diff = i 102 | if not same: 103 | last_diff = i 104 | i = i + 1 105 | 106 | if first_diff is None: 107 | return 108 | 109 | self.display.setDisplayCached(True, False, False) 110 | self.display.setPosition(first_diff, y) 111 | self.display.writeStr(line[first_diff:(last_diff+1)]) 112 | 113 | self.last_line[y] = line 114 | 115 | def update_display_20x4(self): 116 | # calculate cursor offset taking decimal point into consideration 117 | if self.cursor_x == 0: 118 | cursor_offs = 6 119 | else: 120 | cursor_offs = 7 + self.cursor_x 121 | 122 | line1 = "Set: %6.3f A %6.1f C" % (self.desired_ma/1000.0, self.temperature) 123 | line2 = "Act: %6.3f A" % (self.actual_ma/1000.0) 124 | line3 = "Vol: %6.3f V" % self.actual_volts 125 | line4 = "Pow: %6.3f W" % self.actual_watts 126 | 127 | # The VFD supports a blink, but the problem I found is that with blink 128 | # enabled, occasional cursors will be visible in non-cursor positions as 129 | # the display is updated. So I chose to emulate blink myself. 130 | if self.display_nocursor: 131 | if self.update_count % 2 == 1: 132 | line1 = line1[:cursor_offs] + chr(0xFF) + line1[(cursor_offs+1):] 133 | 134 | self.writeLineDelta(0, trimpad(line1, 20)) 135 | self.writeLineDelta(1, trimpad(line2, 20)) 136 | self.writeLineDelta(2, trimpad(line3, 20)) 137 | self.writeLineDelta(3, trimpad(line4, 20)) 138 | 139 | self.display.setPosition(cursor_offs, 0) 140 | self.display.setDisplayCached(True, not self.display_nocursor, False) 141 | 142 | self.update_count = self.update_count + 1 143 | 144 | def update_display(self): 145 | if self.display_kind == "20x4": 146 | self.update_display_20x4() 147 | else: 148 | self.update_display_16x2() 149 | 150 | def get_mult(self): 151 | if self.cursor_x == 3: 152 | return 1 153 | elif self.cursor_x == 2: 154 | return 10 155 | elif self.cursor_x == 1: 156 | return 100 157 | else: 158 | return 1000 159 | 160 | def control_poll(self): 161 | self.actual_ma = self.GetActualMilliamps() * self.atrim 162 | self.actual_volts = self.GetActualVolts() * self.vtrim 163 | self.actual_watts = float(self.actual_volts) * float(self.actual_ma) / 1000.0 164 | 165 | if self.display.poller.get_button1_event(): 166 | self.cursor_x = max(0, self.cursor_x-1) 167 | 168 | if self.display.poller.get_button3_event(): 169 | self.cursor_x = min(3, self.cursor_x+1) 170 | 171 | delta = self.display.poller.get_delta() 172 | if delta != 0: 173 | mult = self.get_mult() 174 | self.new_desired_ma = min(10000, max(0, float(self.desired_ma) + delta * mult)) 175 | 176 | if self.new_desired_ma is not None: 177 | self.desired_ma = self.new_desired_ma 178 | self.SetDesiredMilliamps(self.desired_ma) 179 | self.new_desired_ma = None 180 | 181 | self.update_display() 182 | 183 | def temperature_poll(self): 184 | self.temperature = self.ds.measure_first_device() 185 | 186 | def start_thread(self): 187 | self.poll_thread = DCLoad_Thread(self) 188 | self.poll_thread.start() 189 | 190 | self.temperature_thread = Temperature_Thread(self) 191 | self.temperature_thread.start() 192 | 193 | def set_new_desired_ma(self, ma): 194 | self.new_desired_ma = ma 195 | 196 | 197 | class DCLoad_Thread(threading.Thread): 198 | def __init__(self, load): 199 | threading.Thread.__init__(self) 200 | self.load = load 201 | self.daemon = True 202 | self.stopping = False 203 | 204 | def run(self): 205 | while not self.stopping: 206 | self.load.control_poll() 207 | time.sleep(0.1) 208 | 209 | 210 | class Temperature_Thread(threading.Thread): 211 | def __init__(self, load): 212 | threading.Thread.__init__(self) 213 | self.load = load 214 | self.daemon = True 215 | self.stopping = False 216 | 217 | def run(self): 218 | while not self.stopping: 219 | self.load.temperature_poll() 220 | time.sleep(1) 221 | 222 | 223 | def parse_args(): 224 | defaults = {"sense_ohms": DEFAULT_SENSE_OHMS, 225 | "atrim": DEFAULT_ATRIM, 226 | "vtrim": DEFAULT_VTRIM} 227 | 228 | # Get the config file argument 229 | 230 | conf_parser = argparse.ArgumentParser(add_help=False) 231 | _help = 'Config file name (default: %s)' % DEFAULT_CONFIG_FILE 232 | conf_parser.add_argument( 233 | '-c', '--conf_file', dest='conf_file', 234 | default=DEFAULT_CONFIG_FILE, 235 | type=str, 236 | help=_help) 237 | args, remaining_argv = conf_parser.parse_known_args() 238 | 239 | # Load the config file 240 | 241 | if args.conf_file: 242 | if not os.path.exists(args.conf_file): 243 | print >> sys.stderr, "Config file", args.conf_file, "does not exist. Not reading config." 244 | else: 245 | config = ConfigParser.SafeConfigParser() 246 | config.read(args.conf_file) 247 | defaults.update(dict(config.items("defaults"))) 248 | 249 | # Parse the rest of the args 250 | 251 | parser = argparse.ArgumentParser(parents=[conf_parser]) 252 | 253 | _help = 'Sense resistor ohms (default: %0.1f)' % DEFAULT_SENSE_OHMS 254 | parser.add_argument( 255 | '-s', '--sense', dest='sense_ohms', 256 | default=defaults["sense_ohms"], 257 | type=float, 258 | help=_help) 259 | 260 | _help = 'Amp Trim (default: %0.1f)' % DEFAULT_ATRIM 261 | parser.add_argument( 262 | '-a', '--atrim', dest='atrim', 263 | default=defaults["atrim"], 264 | type=float, 265 | help=_help) 266 | 267 | _help = 'Volt Trim (default: %0.1f)' % DEFAULT_VTRIM 268 | parser.add_argument( 269 | '-t', '--vtrim', dest='vtrim', 270 | default=defaults["vtrim"], 271 | type=float, 272 | help=_help) 273 | 274 | args = parser.parse_args() 275 | 276 | return args 277 | 278 | 279 | def startup(): 280 | global glo_dcload 281 | 282 | args = parse_args() 283 | 284 | bus = smbus.SMBus(1) 285 | spi = spidev.SpiDev() 286 | 287 | print "Setup: vtrim=%0.3f, atrim=%0.3f, sense_ohms=%0.1f" % (args.vtrim, args.atrim, args.sense_ohms) 288 | 289 | glo_dcload = DCLoad_Control(bus, spi, vtrim=args.vtrim, atrim=args.atrim, 290 | senseOhms=args.sense_ohms) 291 | glo_dcload.start() 292 | 293 | 294 | def main(): 295 | startup() 296 | while True: 297 | time.sleep(1) 298 | 299 | 300 | if __name__ == "__main__": 301 | main() 302 | -------------------------------------------------------------------------------- /dcload_django/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sbelectronics/pi-dcload/0fa73639a875b69b3137bfe737242e6fc54fd7cd/dcload_django/__init__.py -------------------------------------------------------------------------------- /dcload_django/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for dcload project. 3 | 4 | For more information on this file, see 5 | https://docs.djangoproject.com/en/1.7/topics/settings/ 6 | 7 | For the full list of settings and their values, see 8 | https://docs.djangoproject.com/en/1.7/ref/settings/ 9 | """ 10 | 11 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 12 | import os 13 | BASE_DIR = os.path.dirname(os.path.dirname(__file__)) 14 | 15 | # Quick-start development settings - unsuitable for production 16 | # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ 17 | 18 | # SECURITY WARNING: keep the secret key used in production secret! 19 | SECRET_KEY = 'ky!uh05h608&dgz3(*tcrdyv022v7d28p_7-xxv37r!q%bjzu%' 20 | 21 | # SECURITY WARNING: don't run with debug turned on in production! 22 | DEBUG = True 23 | 24 | TEMPLATE_DEBUG = True 25 | 26 | ALLOWED_HOSTS = [] 27 | 28 | TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')] 29 | 30 | # Application definition 31 | 32 | INSTALLED_APPS = ( 33 | 'django.contrib.admin', 34 | 'django.contrib.auth', 35 | 'django.contrib.contenttypes', 36 | 'django.contrib.sessions', 37 | 'django.contrib.messages', 38 | 'django.contrib.staticfiles', 39 | ) 40 | 41 | MIDDLEWARE_CLASSES = ( 42 | 'django.contrib.sessions.middleware.SessionMiddleware', 43 | 'django.middleware.common.CommonMiddleware', 44 | 'django.middleware.csrf.CsrfViewMiddleware', 45 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 46 | 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 47 | 'django.contrib.messages.middleware.MessageMiddleware', 48 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 49 | ) 50 | 51 | ROOT_URLCONF = 'dcload_django.urls' 52 | 53 | WSGI_APPLICATION = 'dcload_django.wsgi.application' 54 | 55 | 56 | # Database 57 | # https://docs.djangoproject.com/en/1.7/ref/settings/#databases 58 | 59 | DATABASES = { 60 | 'default': { 61 | 'ENGINE': 'django.db.backends.sqlite3', 62 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 63 | } 64 | } 65 | 66 | # Internationalization 67 | # https://docs.djangoproject.com/en/1.7/topics/i18n/ 68 | 69 | LANGUAGE_CODE = 'en-us' 70 | 71 | TIME_ZONE = 'UTC' 72 | 73 | USE_I18N = True 74 | 75 | USE_L10N = True 76 | 77 | USE_TZ = True 78 | 79 | 80 | # Static files (CSS, JavaScript, Images) 81 | # https://docs.djangoproject.com/en/1.7/howto/static-files/ 82 | 83 | STATIC_URL = '/static/' 84 | 85 | STATICFILES_DIRS = ("./static",) 86 | 87 | STATICFILES_FINDERS = ( 88 | 'django.contrib.staticfiles.finders.FileSystemFinder', 89 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 90 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder', 91 | ) 92 | 93 | LOGGING = { 94 | 'version': 1, 95 | 'disable_existing_loggers': False, 96 | 'filters': { 97 | 'require_debug_false': { 98 | '()': 'django.utils.log.RequireDebugFalse' 99 | } 100 | }, 101 | 'handlers': { 102 | 'mail_admins': { 103 | 'level': 'ERROR', 104 | 'filters': ['require_debug_false'], 105 | 'class': 'django.utils.log.AdminEmailHandler' 106 | } 107 | }, 108 | 'loggers': { 109 | 'django.request': { 110 | 'handlers': ['mail_admins'], 111 | 'level': 'ERROR', 112 | 'propagate': True, 113 | }, 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /dcload_django/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, include, url 2 | from django.contrib import admin 3 | from django.views.generic.base import RedirectView 4 | 5 | urlpatterns = patterns('', 6 | # Examples: 7 | # url(r'^$', 'xmas.views.home', name='home'), 8 | # url(r'^blog/', include('blog.urls')), 9 | 10 | url(r'^$', RedirectView.as_view(url='/dcload/', permanent=False), name='index'), 11 | 12 | url(r'^dcload/', include('dcload_ui.urls')), 13 | url(r'^admin/', include(admin.site.urls)), 14 | ) 15 | -------------------------------------------------------------------------------- /dcload_django/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for xmas project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dcload_django.settings") 12 | 13 | from django.core.wsgi import get_wsgi_application 14 | application = get_wsgi_application() 15 | -------------------------------------------------------------------------------- /dcload_ui/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sbelectronics/pi-dcload/0fa73639a875b69b3137bfe737242e6fc54fd7cd/dcload_ui/__init__.py -------------------------------------------------------------------------------- /dcload_ui/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /dcload_ui/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /dcload_ui/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /dcload_ui/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, url 2 | 3 | from dcload_ui import views 4 | 5 | urlpatterns = patterns('', 6 | url(r'^$', views.index, name='index'), 7 | url(r'^setDesiredMa$', views.setDesiredMa, name='setDesiredMa'), 8 | url(r'^setPower$', views.setPower, name='setPower'), 9 | url(r'^getStatus$', views.getStatus, name='getStatus'), 10 | ) 11 | -------------------------------------------------------------------------------- /dcload_ui/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.template import RequestContext, loader 3 | import json 4 | 5 | from dcload_control import glo_dcload 6 | 7 | # Create your views here. 8 | 9 | from django.http import HttpResponse 10 | 11 | 12 | def index(request): 13 | template = loader.get_template('dcload_ui/index.html') 14 | context = RequestContext(request, {}); 15 | return HttpResponse(template.render(context)) 16 | 17 | 18 | def setDesiredMa(request): 19 | value = request.GET.get("value", "0") 20 | value = float(value) 21 | glo_dcload.set_new_desired_ma(value) 22 | 23 | return HttpResponse("okey dokey") 24 | 25 | 26 | def setPower(request): 27 | # not implemented 28 | 29 | return HttpResponse("okey dokey") 30 | 31 | 32 | def getStatus(request): 33 | result = {"actual_ma": glo_dcload.actual_ma, 34 | "actual_volts": glo_dcload.actual_volts, 35 | "actual_watts": glo_dcload.actual_watts, 36 | "actual_temp": glo_dcload.temperature, 37 | "desired_ma": glo_dcload.desired_ma, 38 | "new_desired_ma": glo_dcload.new_desired_ma, 39 | "power": True} 40 | 41 | return HttpResponse(json.dumps(result), content_type='application/javascript') 42 | -------------------------------------------------------------------------------- /start_django.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | cd /home/pi/dcload 3 | nohup python ./web_server.py > /tmp/dcload.out 2> /tmp/dcload.err & 4 | -------------------------------------------------------------------------------- /static/css/chosen.css: -------------------------------------------------------------------------------- 1 | /*! 2 | Chosen, a Select Box Enhancer for jQuery and Prototype 3 | by Patrick Filler for Harvest, http://getharvest.com 4 | 5 | Version 1.4.2 6 | Full source at https://github.com/harvesthq/chosen 7 | Copyright (c) 2011-2015 Harvest http://getharvest.com 8 | 9 | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md 10 | This file is generated by `grunt build`, do not edit it by hand. 11 | */ 12 | 13 | /* @group Base */ 14 | .chosen-container { 15 | position: relative; 16 | display: inline-block; 17 | vertical-align: middle; 18 | font-size: 13px; 19 | zoom: 1; 20 | *display: inline; 21 | -webkit-user-select: none; 22 | -moz-user-select: none; 23 | user-select: none; 24 | } 25 | .chosen-container * { 26 | -webkit-box-sizing: border-box; 27 | -moz-box-sizing: border-box; 28 | box-sizing: border-box; 29 | } 30 | .chosen-container .chosen-drop { 31 | position: absolute; 32 | top: 100%; 33 | left: -9999px; 34 | z-index: 1010; 35 | width: 100%; 36 | border: 1px solid #aaa; 37 | border-top: 0; 38 | background: #fff; 39 | box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); 40 | } 41 | .chosen-container.chosen-with-drop .chosen-drop { 42 | left: 0; 43 | } 44 | .chosen-container a { 45 | cursor: pointer; 46 | } 47 | .chosen-container .search-choice .group-name, .chosen-container .chosen-single .group-name { 48 | margin-right: 4px; 49 | overflow: hidden; 50 | white-space: nowrap; 51 | text-overflow: ellipsis; 52 | font-weight: normal; 53 | color: #999999; 54 | } 55 | .chosen-container .search-choice .group-name:after, .chosen-container .chosen-single .group-name:after { 56 | content: ":"; 57 | padding-left: 2px; 58 | vertical-align: top; 59 | } 60 | 61 | /* @end */ 62 | /* @group Single Chosen */ 63 | .chosen-container-single .chosen-single { 64 | position: relative; 65 | display: block; 66 | overflow: hidden; 67 | padding: 0 0 0 8px; 68 | height: 25px; 69 | border: 1px solid #aaa; 70 | border-radius: 5px; 71 | background-color: #fff; 72 | background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4)); 73 | background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); 74 | background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); 75 | background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); 76 | background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); 77 | background-clip: padding-box; 78 | box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1); 79 | color: #444; 80 | text-decoration: none; 81 | white-space: nowrap; 82 | line-height: 24px; 83 | } 84 | .chosen-container-single .chosen-default { 85 | color: #999; 86 | } 87 | .chosen-container-single .chosen-single span { 88 | display: block; 89 | overflow: hidden; 90 | margin-right: 26px; 91 | text-overflow: ellipsis; 92 | white-space: nowrap; 93 | } 94 | .chosen-container-single .chosen-single-with-deselect span { 95 | margin-right: 38px; 96 | } 97 | .chosen-container-single .chosen-single abbr { 98 | position: absolute; 99 | top: 6px; 100 | right: 26px; 101 | display: block; 102 | width: 12px; 103 | height: 12px; 104 | background: url('/static/icons/chosen-sprite.png') -42px 1px no-repeat; 105 | font-size: 1px; 106 | } 107 | .chosen-container-single .chosen-single abbr:hover { 108 | background-position: -42px -10px; 109 | } 110 | .chosen-container-single.chosen-disabled .chosen-single abbr:hover { 111 | background-position: -42px -10px; 112 | } 113 | .chosen-container-single .chosen-single div { 114 | position: absolute; 115 | top: 0; 116 | right: 0; 117 | display: block; 118 | width: 18px; 119 | height: 100%; 120 | } 121 | .chosen-container-single .chosen-single div b { 122 | display: block; 123 | width: 100%; 124 | height: 100%; 125 | background: url('/static/icons/chosen-sprite.png') no-repeat 0px 2px; 126 | } 127 | .chosen-container-single .chosen-search { 128 | position: relative; 129 | z-index: 1010; 130 | margin: 0; 131 | padding: 3px 4px; 132 | white-space: nowrap; 133 | } 134 | .chosen-container-single .chosen-search input[type="text"] { 135 | margin: 1px 0; 136 | padding: 4px 20px 4px 5px; 137 | width: 100%; 138 | height: auto; 139 | outline: 0; 140 | border: 1px solid #aaa; 141 | background: white url('/static/icons/chosen-sprite.png') no-repeat 100% -20px; 142 | background: url('/static/icons/chosen-sprite.png') no-repeat 100% -20px; 143 | font-size: 1em; 144 | font-family: sans-serif; 145 | line-height: normal; 146 | border-radius: 0; 147 | } 148 | .chosen-container-single .chosen-drop { 149 | margin-top: -1px; 150 | border-radius: 0 0 4px 4px; 151 | background-clip: padding-box; 152 | } 153 | .chosen-container-single.chosen-container-single-nosearch .chosen-search { 154 | position: absolute; 155 | left: -9999px; 156 | } 157 | 158 | /* @end */ 159 | /* @group Results */ 160 | .chosen-container .chosen-results { 161 | color: #444; 162 | position: relative; 163 | overflow-x: hidden; 164 | overflow-y: auto; 165 | margin: 0 4px 4px 0; 166 | padding: 0 0 0 4px; 167 | max-height: 240px; 168 | -webkit-overflow-scrolling: touch; 169 | } 170 | .chosen-container .chosen-results li { 171 | display: none; 172 | margin: 0; 173 | padding: 5px 6px; 174 | list-style: none; 175 | line-height: 15px; 176 | word-wrap: break-word; 177 | -webkit-touch-callout: none; 178 | } 179 | .chosen-container .chosen-results li.active-result { 180 | display: list-item; 181 | cursor: pointer; 182 | } 183 | .chosen-container .chosen-results li.disabled-result { 184 | display: list-item; 185 | color: #ccc; 186 | cursor: default; 187 | } 188 | .chosen-container .chosen-results li.highlighted { 189 | background-color: #3875d7; 190 | background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc)); 191 | background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%); 192 | background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%); 193 | background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%); 194 | background-image: linear-gradient(#3875d7 20%, #2a62bc 90%); 195 | color: #fff; 196 | } 197 | .chosen-container .chosen-results li.no-results { 198 | color: #777; 199 | display: list-item; 200 | background: #f4f4f4; 201 | } 202 | .chosen-container .chosen-results li.group-result { 203 | display: list-item; 204 | font-weight: bold; 205 | cursor: default; 206 | } 207 | .chosen-container .chosen-results li.group-option { 208 | padding-left: 15px; 209 | } 210 | .chosen-container .chosen-results li em { 211 | font-style: normal; 212 | text-decoration: underline; 213 | } 214 | 215 | /* @end */ 216 | /* @group Multi Chosen */ 217 | .chosen-container-multi .chosen-choices { 218 | position: relative; 219 | overflow: hidden; 220 | margin: 0; 221 | padding: 0 5px; 222 | width: 100%; 223 | height: auto !important; 224 | height: 1%; 225 | border: 1px solid #aaa; 226 | background-color: #fff; 227 | background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); 228 | background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%); 229 | background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%); 230 | background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%); 231 | background-image: linear-gradient(#eeeeee 1%, #ffffff 15%); 232 | cursor: text; 233 | } 234 | .chosen-container-multi .chosen-choices li { 235 | float: left; 236 | list-style: none; 237 | } 238 | .chosen-container-multi .chosen-choices li.search-field { 239 | margin: 0; 240 | padding: 0; 241 | white-space: nowrap; 242 | } 243 | .chosen-container-multi .chosen-choices li.search-field input[type="text"] { 244 | margin: 1px 0; 245 | padding: 0; 246 | height: 25px; 247 | outline: 0; 248 | border: 0 !important; 249 | background: transparent !important; 250 | box-shadow: none; 251 | color: #999; 252 | font-size: 100%; 253 | font-family: sans-serif; 254 | line-height: normal; 255 | border-radius: 0; 256 | } 257 | .chosen-container-multi .chosen-choices li.search-choice { 258 | position: relative; 259 | margin: 3px 5px 3px 0; 260 | padding: 3px 20px 3px 5px; 261 | border: 1px solid #aaa; 262 | max-width: 100%; 263 | border-radius: 3px; 264 | background-color: #eeeeee; 265 | background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); 266 | background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 267 | background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 268 | background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 269 | background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 270 | background-size: 100% 19px; 271 | background-repeat: repeat-x; 272 | background-clip: padding-box; 273 | box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05); 274 | color: #333; 275 | line-height: 13px; 276 | cursor: default; 277 | } 278 | .chosen-container-multi .chosen-choices li.search-choice span { 279 | word-wrap: break-word; 280 | } 281 | .chosen-container-multi .chosen-choices li.search-choice .search-choice-close { 282 | position: absolute; 283 | top: 4px; 284 | right: 3px; 285 | display: block; 286 | width: 12px; 287 | height: 12px; 288 | background: url('/static/icons/chosen-sprite.png') -42px 1px no-repeat; 289 | font-size: 1px; 290 | } 291 | .chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover { 292 | background-position: -42px -10px; 293 | } 294 | .chosen-container-multi .chosen-choices li.search-choice-disabled { 295 | padding-right: 5px; 296 | border: 1px solid #ccc; 297 | background-color: #e4e4e4; 298 | background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); 299 | background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 300 | background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 301 | background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 302 | background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); 303 | color: #666; 304 | } 305 | .chosen-container-multi .chosen-choices li.search-choice-focus { 306 | background: #d4d4d4; 307 | } 308 | .chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close { 309 | background-position: -42px -10px; 310 | } 311 | .chosen-container-multi .chosen-results { 312 | margin: 0; 313 | padding: 0; 314 | } 315 | .chosen-container-multi .chosen-drop .result-selected { 316 | display: list-item; 317 | color: #ccc; 318 | cursor: default; 319 | } 320 | 321 | /* @end */ 322 | /* @group Active */ 323 | .chosen-container-active .chosen-single { 324 | border: 1px solid #5897fb; 325 | box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); 326 | } 327 | .chosen-container-active.chosen-with-drop .chosen-single { 328 | border: 1px solid #aaa; 329 | -moz-border-radius-bottomright: 0; 330 | border-bottom-right-radius: 0; 331 | -moz-border-radius-bottomleft: 0; 332 | border-bottom-left-radius: 0; 333 | background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff)); 334 | background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%); 335 | background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%); 336 | background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%); 337 | background-image: linear-gradient(#eeeeee 20%, #ffffff 80%); 338 | box-shadow: 0 1px 0 #fff inset; 339 | } 340 | .chosen-container-active.chosen-with-drop .chosen-single div { 341 | border-left: none; 342 | background: transparent; 343 | } 344 | .chosen-container-active.chosen-with-drop .chosen-single div b { 345 | background-position: -18px 2px; 346 | } 347 | .chosen-container-active .chosen-choices { 348 | border: 1px solid #5897fb; 349 | box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); 350 | } 351 | .chosen-container-active .chosen-choices li.search-field input[type="text"] { 352 | color: #222 !important; 353 | } 354 | 355 | /* @end */ 356 | /* @group Disabled Support */ 357 | .chosen-disabled { 358 | opacity: 0.5 !important; 359 | cursor: default; 360 | } 361 | .chosen-disabled .chosen-single { 362 | cursor: default; 363 | } 364 | .chosen-disabled .chosen-choices .search-choice .search-choice-close { 365 | cursor: default; 366 | } 367 | 368 | /* @end */ 369 | /* @group Right to Left */ 370 | .chosen-rtl { 371 | text-align: right; 372 | } 373 | .chosen-rtl .chosen-single { 374 | overflow: visible; 375 | padding: 0 8px 0 0; 376 | } 377 | .chosen-rtl .chosen-single span { 378 | margin-right: 0; 379 | margin-left: 26px; 380 | direction: rtl; 381 | } 382 | .chosen-rtl .chosen-single-with-deselect span { 383 | margin-left: 38px; 384 | } 385 | .chosen-rtl .chosen-single div { 386 | right: auto; 387 | left: 3px; 388 | } 389 | .chosen-rtl .chosen-single abbr { 390 | right: auto; 391 | left: 26px; 392 | } 393 | .chosen-rtl .chosen-choices li { 394 | float: right; 395 | } 396 | .chosen-rtl .chosen-choices li.search-field input[type="text"] { 397 | direction: rtl; 398 | } 399 | .chosen-rtl .chosen-choices li.search-choice { 400 | margin: 3px 5px 3px 0; 401 | padding: 3px 5px 3px 19px; 402 | } 403 | .chosen-rtl .chosen-choices li.search-choice .search-choice-close { 404 | right: auto; 405 | left: 4px; 406 | } 407 | .chosen-rtl.chosen-container-single-nosearch .chosen-search, 408 | .chosen-rtl .chosen-drop { 409 | left: 9999px; 410 | } 411 | .chosen-rtl.chosen-container-single .chosen-results { 412 | margin: 0 0 4px 4px; 413 | padding: 0 4px 0 0; 414 | } 415 | .chosen-rtl .chosen-results li.group-option { 416 | padding-right: 15px; 417 | padding-left: 0; 418 | } 419 | .chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div { 420 | border-right: none; 421 | } 422 | .chosen-rtl .chosen-search input[type="text"] { 423 | padding: 4px 5px 4px 20px; 424 | background: white url('/static/icons/chosen-sprite.png') no-repeat -30px -20px; 425 | background: url('/static/icons/chosen-sprite.png') no-repeat -30px -20px; 426 | direction: rtl; 427 | } 428 | .chosen-rtl.chosen-container-single .chosen-single div b { 429 | background-position: 6px 2px; 430 | } 431 | .chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b { 432 | background-position: -12px 2px; 433 | } 434 | 435 | /* @end */ 436 | /* @group Retina compatibility */ 437 | @media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi), only screen and (min-resolution: 1.5dppx) { 438 | .chosen-rtl .chosen-search input[type="text"], 439 | .chosen-container-single .chosen-single abbr, 440 | .chosen-container-single .chosen-single div b, 441 | .chosen-container-single .chosen-search input[type="text"], 442 | .chosen-container-multi .chosen-choices .search-choice .search-choice-close, 443 | .chosen-container .chosen-results-scroll-down span, 444 | .chosen-container .chosen-results-scroll-up span { 445 | background-image: url('/static/icons/chosen-sprite@2x.png') !important; 446 | background-size: 52px 37px !important; 447 | background-repeat: no-repeat !important; 448 | } 449 | } 450 | /* @end */ 451 | -------------------------------------------------------------------------------- /static/css/color-buttons.css: -------------------------------------------------------------------------------- 1 | .btn-red { 2 | background-color: #ff0000; 3 | border-color: #ff0000; 4 | } 5 | .btn-red:hover, 6 | .btn-red:focus, 7 | .btn-red:active, 8 | .btn-red.active { 9 | background-color: #e60000; 10 | border-color: #cc0000; 11 | } 12 | .btn-red.disabled:hover, 13 | .btn-red.disabled:focus, 14 | .btn-red.disabled:active, 15 | .btn-red.disabled.active, 16 | .btn-red[disabled]:hover, 17 | .btn-red[disabled]:focus, 18 | .btn-red[disabled]:active, 19 | .btn-red[disabled].active, 20 | fieldset[disabled] .btn-red:hover, 21 | fieldset[disabled] .btn-red:focus, 22 | fieldset[disabled] .btn-red:active, 23 | fieldset[disabled] .btn-red.active { 24 | background-color: #ff0000; 25 | border-color: #ff0000; 26 | } 27 | 28 | .btn-green { 29 | background-color: #00ff00; 30 | border-color: #00ff00; 31 | } 32 | .btn-green:hover, 33 | .btn-green:focus, 34 | .btn-green:active, 35 | .btn-green.active { 36 | background-color: #00e600; 37 | border-color: #00cc00; 38 | } 39 | .btn-green.disabled:hover, 40 | .btn-green.disabled:focus, 41 | .btn-green.disabled:active, 42 | .btn-green.disabled.active, 43 | .btn-green[disabled]:hover, 44 | .btn-green[disabled]:focus, 45 | .btn-green[disabled]:active, 46 | .btn-green[disabled].active, 47 | fieldset[disabled] .btn-green:hover, 48 | fieldset[disabled] .btn-green:focus, 49 | fieldset[disabled] .btn-green:active, 50 | fieldset[disabled] .btn-green.active { 51 | background-color: #00ff00; 52 | border-color: #00ff00; 53 | } 54 | 55 | .btn-blue { 56 | background-color: #0000ff; 57 | border-color: #0000ff; 58 | color: white; 59 | } 60 | .btn-blue:hover, 61 | .btn-blue:focus, 62 | .btn-blue:active, 63 | .btn-blue.active { 64 | color: white; 65 | background-color: #0000e6; 66 | border-color: #0000cc; 67 | } 68 | .btn-blue.disabled:hover, 69 | .btn-blue.disabled:focus, 70 | .btn-blue.disabled:active, 71 | .btn-blue.disabled.active, 72 | .btn-blue[disabled]:hover, 73 | .btn-blue[disabled]:focus, 74 | .btn-blue[disabled]:active, 75 | .btn-blue[disabled].active, 76 | fieldset[disabled] .btn-blue:hover, 77 | fieldset[disabled] .btn-blue:focus, 78 | fieldset[disabled] .btn-blue:active, 79 | fieldset[disabled] .btn-blue.active { 80 | background-color: #0000ff; 81 | border-color: #0000ff; 82 | } 83 | 84 | .btn-white { 85 | background-color: #ffffff; 86 | border-color: #000000; 87 | } 88 | .btn-white:hover, 89 | .btn-white:focus, 90 | .btn-white:active, 91 | .btn-white.active { 92 | background-color: #f2f2f2; 93 | border-color: #e6e6e6; 94 | } 95 | .btn-white.disabled:hover, 96 | .btn-white.disabled:focus, 97 | .btn-white.disabled:active, 98 | .btn-white.disabled.active, 99 | .btn-white[disabled]:hover, 100 | .btn-white[disabled]:focus, 101 | .btn-white[disabled]:active, 102 | .btn-white[disabled].active, 103 | fieldset[disabled] .btn-white:hover, 104 | fieldset[disabled] .btn-white:focus, 105 | fieldset[disabled] .btn-white:active, 106 | fieldset[disabled] .btn-white.active { 107 | background-color: #ffffff; 108 | border-color: #ffffff; 109 | } 110 | 111 | .btn-magenta { 112 | background-color: #ff00ff; 113 | border-color: #ff00ff; 114 | } 115 | .btn-magenta:hover, 116 | .btn-magenta:focus, 117 | .btn-magenta:active, 118 | .btn-magenta.active { 119 | background-color: #e600e6; 120 | border-color: #cc00cc; 121 | } 122 | .btn-magenta.disabled:hover, 123 | .btn-magenta.disabled:focus, 124 | .btn-magenta.disabled:active, 125 | .btn-magenta.disabled.active, 126 | .btn-magenta[disabled]:hover, 127 | .btn-magenta[disabled]:focus, 128 | .btn-magenta[disabled]:active, 129 | .btn-magenta[disabled].active, 130 | fieldset[disabled] .btn-magenta:hover, 131 | fieldset[disabled] .btn-magenta:focus, 132 | fieldset[disabled] .btn-magenta:active, 133 | fieldset[disabled] .btn-magenta.active { 134 | background-color: #ff00ff; 135 | border-color: #ff00ff; 136 | } 137 | 138 | .btn-yellow { 139 | background-color: #ffff00; 140 | border-color: #ffff00; 141 | } 142 | .btn-yellow:hover, 143 | .btn-yellow:focus, 144 | .btn-yellow:active, 145 | .btn-yellow.active { 146 | background-color: #e6e600; 147 | border-color: #cccc00; 148 | } 149 | .btn-yellow.disabled:hover, 150 | .btn-yellow.disabled:focus, 151 | .btn-yellow.disabled:active, 152 | .btn-yellow.disabled.active, 153 | .btn-yellow[disabled]:hover, 154 | .btn-yellow[disabled]:focus, 155 | .btn-yellow[disabled]:active, 156 | .btn-yellow[disabled].active, 157 | fieldset[disabled] .btn-yellow:hover, 158 | fieldset[disabled] .btn-yellow:focus, 159 | fieldset[disabled] .btn-yellow:active, 160 | fieldset[disabled] .btn-yellow.active { 161 | background-color: #ffff00; 162 | border-color: #ffff00; 163 | } 164 | 165 | .btn-cyan { 166 | background-color: #00ffff; 167 | border-color: #00ffff; 168 | } 169 | .btn-cyan:hover, 170 | .btn-cyan:focus, 171 | .btn-cyan:active, 172 | .btn-cyan.active { 173 | background-color: #00e6e6; 174 | border-color: #00cccc; 175 | } 176 | .btn-cyan.disabled:hover, 177 | .btn-cyan.disabled:focus, 178 | .btn-cyan.disabled:active, 179 | .btn-cyan.disabled.active, 180 | .btn-cyan[disabled]:hover, 181 | .btn-cyan[disabled]:focus, 182 | .btn-cyan[disabled]:active, 183 | .btn-cyan[disabled].active, 184 | fieldset[disabled] .btn-cyan:hover, 185 | fieldset[disabled] .btn-cyan:focus, 186 | fieldset[disabled] .btn-cyan:active, 187 | fieldset[disabled] .btn-cyan.active { 188 | background-color: #00ffff; 189 | border-color: #00ffff; 190 | } 191 | 192 | .btn-bronze { 193 | background-color: #B1Aa60; 194 | border-color: #B1Aa60; 195 | } 196 | .btn-bronze:hover, 197 | .btn-bronze:focus, 198 | .btn-bronze:active, 199 | .btn-bronze.active { 200 | background-color: #827c30; 201 | border-color: #746e30; 202 | } 203 | .btn-bronze.disabled:hover, 204 | .btn-bronze.disabled:focus, 205 | .btn-bronze.disabled:active, 206 | .btn-bronze.disabled.active, 207 | .btn-bronze[disabled]:hover, 208 | .btn-bronze[disabled]:focus, 209 | .btn-bronze[disabled]:active, 210 | .btn-bronze[disabled].active, 211 | fieldset[disabled] .btn-bronze:hover, 212 | fieldset[disabled] .btn-bronze:focus, 213 | fieldset[disabled] .btn-bronze:active, 214 | fieldset[disabled] .btn-bronze.active { 215 | background-color: #B1Aa60; 216 | border-color: #B1Aa60; 217 | } 218 | 219 | .btn-aqua { 220 | background-color: #68B5B2; 221 | border-color: #68B5B2; 222 | } 223 | .btn-aqua:hover, 224 | .btn-aqua:focus, 225 | .btn-aqua:active, 226 | .btn-aqua.active { 227 | background-color: #388582; 228 | border-color: #388582; 229 | } 230 | .btn-aqua.disabled:hover, 231 | .btn-aqua.disabled:focus, 232 | .btn-aqua.disabled:active, 233 | .btn-aqua.disabled.active, 234 | .btn-aqua[disabled]:hover, 235 | .btn-aqua[disabled]:focus, 236 | .btn-aqua[disabled]:active, 237 | .btn-aqua[disabled].active, 238 | fieldset[disabled] .btn-aqua:hover, 239 | fieldset[disabled] .btn-aqua:focus, 240 | fieldset[disabled] .btn-aqua:active, 241 | fieldset[disabled] .btn-aqua.active { 242 | background-color: #68B5B2; 243 | border-color: #68B5B2; 244 | } 245 | 246 | .btn-orchid { 247 | background-color: #EA80E6; 248 | border-color: #EA80E6; 249 | } 250 | .btn-orchid:hover, 251 | .btn-orchid:focus, 252 | .btn-orchid:active, 253 | .btn-orchid.active { 254 | background-color: #BA50B6; 255 | border-color: #BA50B6; 256 | } 257 | .btn-orchid.disabled:hover, 258 | .btn-orchid.disabled:focus, 259 | .btn-orchid.disabled:active, 260 | .btn-orchid.disabled.active, 261 | .btn-orchid[disabled]:hover, 262 | .btn-orchid[disabled]:focus, 263 | .btn-orchid[disabled]:active, 264 | .btn-orchid[disabled].active, 265 | fieldset[disabled] .btn-orchid:hover, 266 | fieldset[disabled] .btn-orchid:focus, 267 | fieldset[disabled] .btn-orchid:active, 268 | fieldset[disabled] .btn-orchid.active { 269 | background-color: #EA80E6; 270 | border-color: #EA80E6; 271 | } 272 | 273 | .btn-wheat { 274 | background-color: #F5DEB3; 275 | border-color: #F5DEB3; 276 | } 277 | .btn-wheat:hover, 278 | .btn-wheat:focus, 279 | .btn-wheat:active, 280 | .btn-wheat.active { 281 | background-color: #C5AE93; 282 | border-color: #C5AE93; 283 | } 284 | .btn-wheat.disabled:hover, 285 | .btn-wheat.disabled:focus, 286 | .btn-wheat.disabled:active, 287 | .btn-wheat.disabled.active, 288 | .btn-wheat[disabled]:hover, 289 | .btn-wheat[disabled]:focus, 290 | .btn-wheat[disabled]:active, 291 | .btn-wheat[disabled].active, 292 | fieldset[disabled] .btn-wheat:hover, 293 | fieldset[disabled] .btn-wheat:focus, 294 | fieldset[disabled] .btn-wheat:active, 295 | fieldset[disabled] .btn-wheat.active { 296 | background-color: #F5DEB3; 297 | border-color: #F5DEB3; 298 | } 299 | -------------------------------------------------------------------------------- /static/css/dcload.css: -------------------------------------------------------------------------------- 1 | /* #slider-ma {float:right;width:80%;} */ 2 | 3 | #actual-ma {text-align: right; font-family: monospace,monospace; font-size:1em;} 4 | #actual-volts {text-align: right; font-family: monospace,monospace; font-size:1em;} 5 | #actual-watts {text-align: right; font-family: monospace,monospace; font-size:1em;} 6 | #actual-temp {text-align: right; font-family: monospace,monospace; font-size:1em;} 7 | #ma-setpoint {text-align: right; font-family: monospace,monospace; font-size:1em;} 8 | 9 | .btn-ma { 10 | margin-top: 5px; 11 | width: 100px; 12 | } 13 | 14 | .ma-input, 15 | .btn-ma-set { 16 | display: inline-block; 17 | padding: 10px 15px; 18 | font-size: 1em; 19 | border-radius: 0; 20 | -webkit-appearance: none; 21 | } 22 | 23 | .ma-input { 24 | border: 1px solid lightgray; 25 | } 26 | 27 | .btn-ma-set { 28 | background-color: lightgreen; 29 | /** 30 | * If the input field has a border, 31 | * you need it here too to achieve equal heights. 32 | */ 33 | border: 1px solid transparent; 34 | } 35 | 36 | #ma-buttons { 37 | padding-top: 10px; 38 | } 39 | 40 | #set-box { 41 | padding-top: 10px; 42 | } 43 | 44 | /* 45 | .btn-ma-set { 46 | margin-top: 5px; 47 | width: 50px; 48 | } 49 | */ -------------------------------------------------------------------------------- /static/css/jquery-ui.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.10.4 - 2014-01-17 2 | * http://jqueryui.com 3 | * Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css 4 | * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px 5 | * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ 6 | 7 | /* Layout helpers 8 | ----------------------------------*/ 9 | .ui-helper-hidden { 10 | display: none; 11 | } 12 | .ui-helper-hidden-accessible { 13 | border: 0; 14 | clip: rect(0 0 0 0); 15 | height: 1px; 16 | margin: -1px; 17 | overflow: hidden; 18 | padding: 0; 19 | position: absolute; 20 | width: 1px; 21 | } 22 | .ui-helper-reset { 23 | margin: 0; 24 | padding: 0; 25 | border: 0; 26 | outline: 0; 27 | line-height: 1.3; 28 | text-decoration: none; 29 | font-size: 100%; 30 | list-style: none; 31 | } 32 | .ui-helper-clearfix:before, 33 | .ui-helper-clearfix:after { 34 | content: ""; 35 | display: table; 36 | border-collapse: collapse; 37 | } 38 | .ui-helper-clearfix:after { 39 | clear: both; 40 | } 41 | .ui-helper-clearfix { 42 | min-height: 0; /* support: IE7 */ 43 | } 44 | .ui-helper-zfix { 45 | width: 100%; 46 | height: 100%; 47 | top: 0; 48 | left: 0; 49 | position: absolute; 50 | opacity: 0; 51 | filter:Alpha(Opacity=0); 52 | } 53 | 54 | .ui-front { 55 | z-index: 100; 56 | } 57 | 58 | 59 | /* Interaction Cues 60 | ----------------------------------*/ 61 | .ui-state-disabled { 62 | cursor: default !important; 63 | } 64 | 65 | 66 | /* Icons 67 | ----------------------------------*/ 68 | 69 | /* states and images */ 70 | .ui-icon { 71 | display: block; 72 | text-indent: -99999px; 73 | overflow: hidden; 74 | background-repeat: no-repeat; 75 | } 76 | 77 | 78 | /* Misc visuals 79 | ----------------------------------*/ 80 | 81 | /* Overlays */ 82 | .ui-widget-overlay { 83 | position: fixed; 84 | top: 0; 85 | left: 0; 86 | width: 100%; 87 | height: 100%; 88 | } 89 | .ui-accordion .ui-accordion-header { 90 | display: block; 91 | cursor: pointer; 92 | position: relative; 93 | margin-top: 2px; 94 | padding: .5em .5em .5em .7em; 95 | min-height: 0; /* support: IE7 */ 96 | } 97 | .ui-accordion .ui-accordion-icons { 98 | padding-left: 2.2em; 99 | } 100 | .ui-accordion .ui-accordion-noicons { 101 | padding-left: .7em; 102 | } 103 | .ui-accordion .ui-accordion-icons .ui-accordion-icons { 104 | padding-left: 2.2em; 105 | } 106 | .ui-accordion .ui-accordion-header .ui-accordion-header-icon { 107 | position: absolute; 108 | left: .5em; 109 | top: 50%; 110 | margin-top: -8px; 111 | } 112 | .ui-accordion .ui-accordion-content { 113 | padding: 1em 2.2em; 114 | border-top: 0; 115 | overflow: auto; 116 | } 117 | .ui-autocomplete { 118 | position: absolute; 119 | top: 0; 120 | left: 0; 121 | cursor: default; 122 | } 123 | .ui-button { 124 | display: inline-block; 125 | position: relative; 126 | padding: 0; 127 | line-height: normal; 128 | margin-right: .1em; 129 | cursor: pointer; 130 | vertical-align: middle; 131 | text-align: center; 132 | overflow: visible; /* removes extra width in IE */ 133 | } 134 | .ui-button, 135 | .ui-button:link, 136 | .ui-button:visited, 137 | .ui-button:hover, 138 | .ui-button:active { 139 | text-decoration: none; 140 | } 141 | /* to make room for the icon, a width needs to be set here */ 142 | .ui-button-icon-only { 143 | width: 2.2em; 144 | } 145 | /* button elements seem to need a little more width */ 146 | button.ui-button-icon-only { 147 | width: 2.4em; 148 | } 149 | .ui-button-icons-only { 150 | width: 3.4em; 151 | } 152 | button.ui-button-icons-only { 153 | width: 3.7em; 154 | } 155 | 156 | /* button text element */ 157 | .ui-button .ui-button-text { 158 | display: block; 159 | line-height: normal; 160 | } 161 | .ui-button-text-only .ui-button-text { 162 | padding: .4em 1em; 163 | } 164 | .ui-button-icon-only .ui-button-text, 165 | .ui-button-icons-only .ui-button-text { 166 | padding: .4em; 167 | text-indent: -9999999px; 168 | } 169 | .ui-button-text-icon-primary .ui-button-text, 170 | .ui-button-text-icons .ui-button-text { 171 | padding: .4em 1em .4em 2.1em; 172 | } 173 | .ui-button-text-icon-secondary .ui-button-text, 174 | .ui-button-text-icons .ui-button-text { 175 | padding: .4em 2.1em .4em 1em; 176 | } 177 | .ui-button-text-icons .ui-button-text { 178 | padding-left: 2.1em; 179 | padding-right: 2.1em; 180 | } 181 | /* no icon support for input elements, provide padding by default */ 182 | input.ui-button { 183 | padding: .4em 1em; 184 | } 185 | 186 | /* button icon element(s) */ 187 | .ui-button-icon-only .ui-icon, 188 | .ui-button-text-icon-primary .ui-icon, 189 | .ui-button-text-icon-secondary .ui-icon, 190 | .ui-button-text-icons .ui-icon, 191 | .ui-button-icons-only .ui-icon { 192 | position: absolute; 193 | top: 50%; 194 | margin-top: -8px; 195 | } 196 | .ui-button-icon-only .ui-icon { 197 | left: 50%; 198 | margin-left: -8px; 199 | } 200 | .ui-button-text-icon-primary .ui-button-icon-primary, 201 | .ui-button-text-icons .ui-button-icon-primary, 202 | .ui-button-icons-only .ui-button-icon-primary { 203 | left: .5em; 204 | } 205 | .ui-button-text-icon-secondary .ui-button-icon-secondary, 206 | .ui-button-text-icons .ui-button-icon-secondary, 207 | .ui-button-icons-only .ui-button-icon-secondary { 208 | right: .5em; 209 | } 210 | 211 | /* button sets */ 212 | .ui-buttonset { 213 | margin-right: 7px; 214 | } 215 | .ui-buttonset .ui-button { 216 | margin-left: 0; 217 | margin-right: -.3em; 218 | } 219 | 220 | /* workarounds */ 221 | /* reset extra padding in Firefox, see h5bp.com/l */ 222 | input.ui-button::-moz-focus-inner, 223 | button.ui-button::-moz-focus-inner { 224 | border: 0; 225 | padding: 0; 226 | } 227 | .ui-datepicker { 228 | width: 17em; 229 | padding: .2em .2em 0; 230 | display: none; 231 | } 232 | .ui-datepicker .ui-datepicker-header { 233 | position: relative; 234 | padding: .2em 0; 235 | } 236 | .ui-datepicker .ui-datepicker-prev, 237 | .ui-datepicker .ui-datepicker-next { 238 | position: absolute; 239 | top: 2px; 240 | width: 1.8em; 241 | height: 1.8em; 242 | } 243 | .ui-datepicker .ui-datepicker-prev-hover, 244 | .ui-datepicker .ui-datepicker-next-hover { 245 | top: 1px; 246 | } 247 | .ui-datepicker .ui-datepicker-prev { 248 | left: 2px; 249 | } 250 | .ui-datepicker .ui-datepicker-next { 251 | right: 2px; 252 | } 253 | .ui-datepicker .ui-datepicker-prev-hover { 254 | left: 1px; 255 | } 256 | .ui-datepicker .ui-datepicker-next-hover { 257 | right: 1px; 258 | } 259 | .ui-datepicker .ui-datepicker-prev span, 260 | .ui-datepicker .ui-datepicker-next span { 261 | display: block; 262 | position: absolute; 263 | left: 50%; 264 | margin-left: -8px; 265 | top: 50%; 266 | margin-top: -8px; 267 | } 268 | .ui-datepicker .ui-datepicker-title { 269 | margin: 0 2.3em; 270 | line-height: 1.8em; 271 | text-align: center; 272 | } 273 | .ui-datepicker .ui-datepicker-title select { 274 | font-size: 1em; 275 | margin: 1px 0; 276 | } 277 | .ui-datepicker select.ui-datepicker-month, 278 | .ui-datepicker select.ui-datepicker-year { 279 | width: 49%; 280 | } 281 | .ui-datepicker table { 282 | width: 100%; 283 | font-size: .9em; 284 | border-collapse: collapse; 285 | margin: 0 0 .4em; 286 | } 287 | .ui-datepicker th { 288 | padding: .7em .3em; 289 | text-align: center; 290 | font-weight: bold; 291 | border: 0; 292 | } 293 | .ui-datepicker td { 294 | border: 0; 295 | padding: 1px; 296 | } 297 | .ui-datepicker td span, 298 | .ui-datepicker td a { 299 | display: block; 300 | padding: .2em; 301 | text-align: right; 302 | text-decoration: none; 303 | } 304 | .ui-datepicker .ui-datepicker-buttonpane { 305 | background-image: none; 306 | margin: .7em 0 0 0; 307 | padding: 0 .2em; 308 | border-left: 0; 309 | border-right: 0; 310 | border-bottom: 0; 311 | } 312 | .ui-datepicker .ui-datepicker-buttonpane button { 313 | float: right; 314 | margin: .5em .2em .4em; 315 | cursor: pointer; 316 | padding: .2em .6em .3em .6em; 317 | width: auto; 318 | overflow: visible; 319 | } 320 | .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { 321 | float: left; 322 | } 323 | 324 | /* with multiple calendars */ 325 | .ui-datepicker.ui-datepicker-multi { 326 | width: auto; 327 | } 328 | .ui-datepicker-multi .ui-datepicker-group { 329 | float: left; 330 | } 331 | .ui-datepicker-multi .ui-datepicker-group table { 332 | width: 95%; 333 | margin: 0 auto .4em; 334 | } 335 | .ui-datepicker-multi-2 .ui-datepicker-group { 336 | width: 50%; 337 | } 338 | .ui-datepicker-multi-3 .ui-datepicker-group { 339 | width: 33.3%; 340 | } 341 | .ui-datepicker-multi-4 .ui-datepicker-group { 342 | width: 25%; 343 | } 344 | .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header, 345 | .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { 346 | border-left-width: 0; 347 | } 348 | .ui-datepicker-multi .ui-datepicker-buttonpane { 349 | clear: left; 350 | } 351 | .ui-datepicker-row-break { 352 | clear: both; 353 | width: 100%; 354 | font-size: 0; 355 | } 356 | 357 | /* RTL support */ 358 | .ui-datepicker-rtl { 359 | direction: rtl; 360 | } 361 | .ui-datepicker-rtl .ui-datepicker-prev { 362 | right: 2px; 363 | left: auto; 364 | } 365 | .ui-datepicker-rtl .ui-datepicker-next { 366 | left: 2px; 367 | right: auto; 368 | } 369 | .ui-datepicker-rtl .ui-datepicker-prev:hover { 370 | right: 1px; 371 | left: auto; 372 | } 373 | .ui-datepicker-rtl .ui-datepicker-next:hover { 374 | left: 1px; 375 | right: auto; 376 | } 377 | .ui-datepicker-rtl .ui-datepicker-buttonpane { 378 | clear: right; 379 | } 380 | .ui-datepicker-rtl .ui-datepicker-buttonpane button { 381 | float: left; 382 | } 383 | .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current, 384 | .ui-datepicker-rtl .ui-datepicker-group { 385 | float: right; 386 | } 387 | .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header, 388 | .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { 389 | border-right-width: 0; 390 | border-left-width: 1px; 391 | } 392 | .ui-dialog { 393 | overflow: hidden; 394 | position: absolute; 395 | top: 0; 396 | left: 0; 397 | padding: .2em; 398 | outline: 0; 399 | } 400 | .ui-dialog .ui-dialog-titlebar { 401 | padding: .4em 1em; 402 | position: relative; 403 | } 404 | .ui-dialog .ui-dialog-title { 405 | float: left; 406 | margin: .1em 0; 407 | white-space: nowrap; 408 | width: 90%; 409 | overflow: hidden; 410 | text-overflow: ellipsis; 411 | } 412 | .ui-dialog .ui-dialog-titlebar-close { 413 | position: absolute; 414 | right: .3em; 415 | top: 50%; 416 | width: 20px; 417 | margin: -10px 0 0 0; 418 | padding: 1px; 419 | height: 20px; 420 | } 421 | .ui-dialog .ui-dialog-content { 422 | position: relative; 423 | border: 0; 424 | padding: .5em 1em; 425 | background: none; 426 | overflow: auto; 427 | } 428 | .ui-dialog .ui-dialog-buttonpane { 429 | text-align: left; 430 | border-width: 1px 0 0 0; 431 | background-image: none; 432 | margin-top: .5em; 433 | padding: .3em 1em .5em .4em; 434 | } 435 | .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { 436 | float: right; 437 | } 438 | .ui-dialog .ui-dialog-buttonpane button { 439 | margin: .5em .4em .5em 0; 440 | cursor: pointer; 441 | } 442 | .ui-dialog .ui-resizable-se { 443 | width: 12px; 444 | height: 12px; 445 | right: -5px; 446 | bottom: -5px; 447 | background-position: 16px 16px; 448 | } 449 | .ui-draggable .ui-dialog-titlebar { 450 | cursor: move; 451 | } 452 | .ui-menu { 453 | list-style: none; 454 | padding: 2px; 455 | margin: 0; 456 | display: block; 457 | outline: none; 458 | } 459 | .ui-menu .ui-menu { 460 | margin-top: -3px; 461 | position: absolute; 462 | } 463 | .ui-menu .ui-menu-item { 464 | margin: 0; 465 | padding: 0; 466 | width: 100%; 467 | /* support: IE10, see #8844 */ 468 | list-style-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7); 469 | } 470 | .ui-menu .ui-menu-divider { 471 | margin: 5px -2px 5px -2px; 472 | height: 0; 473 | font-size: 0; 474 | line-height: 0; 475 | border-width: 1px 0 0 0; 476 | } 477 | .ui-menu .ui-menu-item a { 478 | text-decoration: none; 479 | display: block; 480 | padding: 2px .4em; 481 | line-height: 1.5; 482 | min-height: 0; /* support: IE7 */ 483 | font-weight: normal; 484 | } 485 | .ui-menu .ui-menu-item a.ui-state-focus, 486 | .ui-menu .ui-menu-item a.ui-state-active { 487 | font-weight: normal; 488 | margin: -1px; 489 | } 490 | 491 | .ui-menu .ui-state-disabled { 492 | font-weight: normal; 493 | margin: .4em 0 .2em; 494 | line-height: 1.5; 495 | } 496 | .ui-menu .ui-state-disabled a { 497 | cursor: default; 498 | } 499 | 500 | /* icon support */ 501 | .ui-menu-icons { 502 | position: relative; 503 | } 504 | .ui-menu-icons .ui-menu-item a { 505 | position: relative; 506 | padding-left: 2em; 507 | } 508 | 509 | /* left-aligned */ 510 | .ui-menu .ui-icon { 511 | position: absolute; 512 | top: .2em; 513 | left: .2em; 514 | } 515 | 516 | /* right-aligned */ 517 | .ui-menu .ui-menu-icon { 518 | position: static; 519 | float: right; 520 | } 521 | .ui-progressbar { 522 | height: 2em; 523 | text-align: left; 524 | overflow: hidden; 525 | } 526 | .ui-progressbar .ui-progressbar-value { 527 | margin: -1px; 528 | height: 100%; 529 | } 530 | .ui-progressbar .ui-progressbar-overlay { 531 | background: url("images/animated-overlay.gif"); 532 | height: 100%; 533 | filter: alpha(opacity=25); 534 | opacity: 0.25; 535 | } 536 | .ui-progressbar-indeterminate .ui-progressbar-value { 537 | background-image: none; 538 | } 539 | .ui-resizable { 540 | position: relative; 541 | } 542 | .ui-resizable-handle { 543 | position: absolute; 544 | font-size: 0.1px; 545 | display: block; 546 | } 547 | .ui-resizable-disabled .ui-resizable-handle, 548 | .ui-resizable-autohide .ui-resizable-handle { 549 | display: none; 550 | } 551 | .ui-resizable-n { 552 | cursor: n-resize; 553 | height: 7px; 554 | width: 100%; 555 | top: -5px; 556 | left: 0; 557 | } 558 | .ui-resizable-s { 559 | cursor: s-resize; 560 | height: 7px; 561 | width: 100%; 562 | bottom: -5px; 563 | left: 0; 564 | } 565 | .ui-resizable-e { 566 | cursor: e-resize; 567 | width: 7px; 568 | right: -5px; 569 | top: 0; 570 | height: 100%; 571 | } 572 | .ui-resizable-w { 573 | cursor: w-resize; 574 | width: 7px; 575 | left: -5px; 576 | top: 0; 577 | height: 100%; 578 | } 579 | .ui-resizable-se { 580 | cursor: se-resize; 581 | width: 12px; 582 | height: 12px; 583 | right: 1px; 584 | bottom: 1px; 585 | } 586 | .ui-resizable-sw { 587 | cursor: sw-resize; 588 | width: 9px; 589 | height: 9px; 590 | left: -5px; 591 | bottom: -5px; 592 | } 593 | .ui-resizable-nw { 594 | cursor: nw-resize; 595 | width: 9px; 596 | height: 9px; 597 | left: -5px; 598 | top: -5px; 599 | } 600 | .ui-resizable-ne { 601 | cursor: ne-resize; 602 | width: 9px; 603 | height: 9px; 604 | right: -5px; 605 | top: -5px; 606 | } 607 | .ui-selectable-helper { 608 | position: absolute; 609 | z-index: 100; 610 | border: 1px dotted black; 611 | } 612 | .ui-slider { 613 | position: relative; 614 | text-align: left; 615 | } 616 | .ui-slider .ui-slider-handle { 617 | position: absolute; 618 | z-index: 2; 619 | width: 1.2em; 620 | height: 1.2em; 621 | cursor: default; 622 | } 623 | .ui-slider .ui-slider-range { 624 | position: absolute; 625 | z-index: 1; 626 | font-size: .7em; 627 | display: block; 628 | border: 0; 629 | background-position: 0 0; 630 | } 631 | 632 | /* For IE8 - See #6727 */ 633 | .ui-slider.ui-state-disabled .ui-slider-handle, 634 | .ui-slider.ui-state-disabled .ui-slider-range { 635 | filter: inherit; 636 | } 637 | 638 | .ui-slider-horizontal { 639 | height: .8em; 640 | } 641 | .ui-slider-horizontal .ui-slider-handle { 642 | top: -.3em; 643 | margin-left: -.6em; 644 | } 645 | .ui-slider-horizontal .ui-slider-range { 646 | top: 0; 647 | height: 100%; 648 | } 649 | .ui-slider-horizontal .ui-slider-range-min { 650 | left: 0; 651 | } 652 | .ui-slider-horizontal .ui-slider-range-max { 653 | right: 0; 654 | } 655 | 656 | .ui-slider-vertical { 657 | width: .8em; 658 | height: 100px; 659 | } 660 | .ui-slider-vertical .ui-slider-handle { 661 | left: -.3em; 662 | margin-left: 0; 663 | margin-bottom: -.6em; 664 | } 665 | .ui-slider-vertical .ui-slider-range { 666 | left: 0; 667 | width: 100%; 668 | } 669 | .ui-slider-vertical .ui-slider-range-min { 670 | bottom: 0; 671 | } 672 | .ui-slider-vertical .ui-slider-range-max { 673 | top: 0; 674 | } 675 | .ui-spinner { 676 | position: relative; 677 | display: inline-block; 678 | overflow: hidden; 679 | padding: 0; 680 | vertical-align: middle; 681 | } 682 | .ui-spinner-input { 683 | border: none; 684 | background: none; 685 | color: inherit; 686 | padding: 0; 687 | margin: .2em 0; 688 | vertical-align: middle; 689 | margin-left: .4em; 690 | margin-right: 22px; 691 | } 692 | .ui-spinner-button { 693 | width: 16px; 694 | height: 50%; 695 | font-size: .5em; 696 | padding: 0; 697 | margin: 0; 698 | text-align: center; 699 | position: absolute; 700 | cursor: default; 701 | display: block; 702 | overflow: hidden; 703 | right: 0; 704 | } 705 | /* more specificity required here to override default borders */ 706 | .ui-spinner a.ui-spinner-button { 707 | border-top: none; 708 | border-bottom: none; 709 | border-right: none; 710 | } 711 | /* vertically center icon */ 712 | .ui-spinner .ui-icon { 713 | position: absolute; 714 | margin-top: -8px; 715 | top: 50%; 716 | left: 0; 717 | } 718 | .ui-spinner-up { 719 | top: 0; 720 | } 721 | .ui-spinner-down { 722 | bottom: 0; 723 | } 724 | 725 | /* TR overrides */ 726 | .ui-spinner .ui-icon-triangle-1-s { 727 | /* need to fix icons sprite */ 728 | background-position: -65px -16px; 729 | } 730 | .ui-tabs { 731 | position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ 732 | padding: .2em; 733 | } 734 | .ui-tabs .ui-tabs-nav { 735 | margin: 0; 736 | padding: .2em .2em 0; 737 | } 738 | .ui-tabs .ui-tabs-nav li { 739 | list-style: none; 740 | float: left; 741 | position: relative; 742 | top: 0; 743 | margin: 1px .2em 0 0; 744 | border-bottom-width: 0; 745 | padding: 0; 746 | white-space: nowrap; 747 | } 748 | .ui-tabs .ui-tabs-nav .ui-tabs-anchor { 749 | float: left; 750 | padding: .5em 1em; 751 | text-decoration: none; 752 | } 753 | .ui-tabs .ui-tabs-nav li.ui-tabs-active { 754 | margin-bottom: -1px; 755 | padding-bottom: 1px; 756 | } 757 | .ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor, 758 | .ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor, 759 | .ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor { 760 | cursor: text; 761 | } 762 | .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor { 763 | cursor: pointer; 764 | } 765 | .ui-tabs .ui-tabs-panel { 766 | display: block; 767 | border-width: 0; 768 | padding: 1em 1.4em; 769 | background: none; 770 | } 771 | .ui-tooltip { 772 | padding: 8px; 773 | position: absolute; 774 | z-index: 9999; 775 | max-width: 300px; 776 | -webkit-box-shadow: 0 0 5px #aaa; 777 | box-shadow: 0 0 5px #aaa; 778 | } 779 | body .ui-tooltip { 780 | border-width: 2px; 781 | } 782 | 783 | /* Component containers 784 | ----------------------------------*/ 785 | .ui-widget { 786 | font-family: Verdana,Arial,sans-serif; 787 | font-size: 1.1em; 788 | } 789 | .ui-widget .ui-widget { 790 | font-size: 1em; 791 | } 792 | .ui-widget input, 793 | .ui-widget select, 794 | .ui-widget textarea, 795 | .ui-widget button { 796 | font-family: Verdana,Arial,sans-serif; 797 | font-size: 1em; 798 | } 799 | .ui-widget-content { 800 | border: 1px solid #aaaaaa; 801 | background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; 802 | color: #222222; 803 | } 804 | .ui-widget-content a { 805 | color: #222222; 806 | } 807 | .ui-widget-header { 808 | border: 1px solid #aaaaaa; 809 | background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; 810 | color: #222222; 811 | font-weight: bold; 812 | } 813 | .ui-widget-header a { 814 | color: #222222; 815 | } 816 | 817 | /* Interaction states 818 | ----------------------------------*/ 819 | .ui-state-default, 820 | .ui-widget-content .ui-state-default, 821 | .ui-widget-header .ui-state-default { 822 | border: 1px solid #d3d3d3; 823 | background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; 824 | font-weight: normal; 825 | color: #555555; 826 | } 827 | .ui-state-default a, 828 | .ui-state-default a:link, 829 | .ui-state-default a:visited { 830 | color: #555555; 831 | text-decoration: none; 832 | } 833 | .ui-state-hover, 834 | .ui-widget-content .ui-state-hover, 835 | .ui-widget-header .ui-state-hover, 836 | .ui-state-focus, 837 | .ui-widget-content .ui-state-focus, 838 | .ui-widget-header .ui-state-focus { 839 | border: 1px solid #999999; 840 | background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; 841 | font-weight: normal; 842 | color: #212121; 843 | } 844 | .ui-state-hover a, 845 | .ui-state-hover a:hover, 846 | .ui-state-hover a:link, 847 | .ui-state-hover a:visited, 848 | .ui-state-focus a, 849 | .ui-state-focus a:hover, 850 | .ui-state-focus a:link, 851 | .ui-state-focus a:visited { 852 | color: #212121; 853 | text-decoration: none; 854 | } 855 | .ui-state-active, 856 | .ui-widget-content .ui-state-active, 857 | .ui-widget-header .ui-state-active { 858 | border: 1px solid #aaaaaa; 859 | background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; 860 | font-weight: normal; 861 | color: #212121; 862 | } 863 | .ui-state-active a, 864 | .ui-state-active a:link, 865 | .ui-state-active a:visited { 866 | color: #212121; 867 | text-decoration: none; 868 | } 869 | 870 | /* Interaction Cues 871 | ----------------------------------*/ 872 | .ui-state-highlight, 873 | .ui-widget-content .ui-state-highlight, 874 | .ui-widget-header .ui-state-highlight { 875 | border: 1px solid #fcefa1; 876 | background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; 877 | color: #363636; 878 | } 879 | .ui-state-highlight a, 880 | .ui-widget-content .ui-state-highlight a, 881 | .ui-widget-header .ui-state-highlight a { 882 | color: #363636; 883 | } 884 | .ui-state-error, 885 | .ui-widget-content .ui-state-error, 886 | .ui-widget-header .ui-state-error { 887 | border: 1px solid #cd0a0a; 888 | background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; 889 | color: #cd0a0a; 890 | } 891 | .ui-state-error a, 892 | .ui-widget-content .ui-state-error a, 893 | .ui-widget-header .ui-state-error a { 894 | color: #cd0a0a; 895 | } 896 | .ui-state-error-text, 897 | .ui-widget-content .ui-state-error-text, 898 | .ui-widget-header .ui-state-error-text { 899 | color: #cd0a0a; 900 | } 901 | .ui-priority-primary, 902 | .ui-widget-content .ui-priority-primary, 903 | .ui-widget-header .ui-priority-primary { 904 | font-weight: bold; 905 | } 906 | .ui-priority-secondary, 907 | .ui-widget-content .ui-priority-secondary, 908 | .ui-widget-header .ui-priority-secondary { 909 | opacity: .7; 910 | filter:Alpha(Opacity=70); 911 | font-weight: normal; 912 | } 913 | .ui-state-disabled, 914 | .ui-widget-content .ui-state-disabled, 915 | .ui-widget-header .ui-state-disabled { 916 | opacity: .35; 917 | filter:Alpha(Opacity=35); 918 | background-image: none; 919 | } 920 | .ui-state-disabled .ui-icon { 921 | filter:Alpha(Opacity=35); /* For IE8 - See #6059 */ 922 | } 923 | 924 | /* Icons 925 | ----------------------------------*/ 926 | 927 | /* states and images */ 928 | .ui-icon { 929 | width: 16px; 930 | height: 16px; 931 | } 932 | .ui-icon, 933 | .ui-widget-content .ui-icon { 934 | background-image: url(images/ui-icons_222222_256x240.png); 935 | } 936 | .ui-widget-header .ui-icon { 937 | background-image: url(images/ui-icons_222222_256x240.png); 938 | } 939 | .ui-state-default .ui-icon { 940 | background-image: url(images/ui-icons_888888_256x240.png); 941 | } 942 | .ui-state-hover .ui-icon, 943 | .ui-state-focus .ui-icon { 944 | background-image: url(images/ui-icons_454545_256x240.png); 945 | } 946 | .ui-state-active .ui-icon { 947 | background-image: url(images/ui-icons_454545_256x240.png); 948 | } 949 | .ui-state-highlight .ui-icon { 950 | background-image: url(images/ui-icons_2e83ff_256x240.png); 951 | } 952 | .ui-state-error .ui-icon, 953 | .ui-state-error-text .ui-icon { 954 | background-image: url(images/ui-icons_cd0a0a_256x240.png); 955 | } 956 | 957 | /* positioning */ 958 | .ui-icon-blank { background-position: 16px 16px; } 959 | .ui-icon-carat-1-n { background-position: 0 0; } 960 | .ui-icon-carat-1-ne { background-position: -16px 0; } 961 | .ui-icon-carat-1-e { background-position: -32px 0; } 962 | .ui-icon-carat-1-se { background-position: -48px 0; } 963 | .ui-icon-carat-1-s { background-position: -64px 0; } 964 | .ui-icon-carat-1-sw { background-position: -80px 0; } 965 | .ui-icon-carat-1-w { background-position: -96px 0; } 966 | .ui-icon-carat-1-nw { background-position: -112px 0; } 967 | .ui-icon-carat-2-n-s { background-position: -128px 0; } 968 | .ui-icon-carat-2-e-w { background-position: -144px 0; } 969 | .ui-icon-triangle-1-n { background-position: 0 -16px; } 970 | .ui-icon-triangle-1-ne { background-position: -16px -16px; } 971 | .ui-icon-triangle-1-e { background-position: -32px -16px; } 972 | .ui-icon-triangle-1-se { background-position: -48px -16px; } 973 | .ui-icon-triangle-1-s { background-position: -64px -16px; } 974 | .ui-icon-triangle-1-sw { background-position: -80px -16px; } 975 | .ui-icon-triangle-1-w { background-position: -96px -16px; } 976 | .ui-icon-triangle-1-nw { background-position: -112px -16px; } 977 | .ui-icon-triangle-2-n-s { background-position: -128px -16px; } 978 | .ui-icon-triangle-2-e-w { background-position: -144px -16px; } 979 | .ui-icon-arrow-1-n { background-position: 0 -32px; } 980 | .ui-icon-arrow-1-ne { background-position: -16px -32px; } 981 | .ui-icon-arrow-1-e { background-position: -32px -32px; } 982 | .ui-icon-arrow-1-se { background-position: -48px -32px; } 983 | .ui-icon-arrow-1-s { background-position: -64px -32px; } 984 | .ui-icon-arrow-1-sw { background-position: -80px -32px; } 985 | .ui-icon-arrow-1-w { background-position: -96px -32px; } 986 | .ui-icon-arrow-1-nw { background-position: -112px -32px; } 987 | .ui-icon-arrow-2-n-s { background-position: -128px -32px; } 988 | .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } 989 | .ui-icon-arrow-2-e-w { background-position: -160px -32px; } 990 | .ui-icon-arrow-2-se-nw { background-position: -176px -32px; } 991 | .ui-icon-arrowstop-1-n { background-position: -192px -32px; } 992 | .ui-icon-arrowstop-1-e { background-position: -208px -32px; } 993 | .ui-icon-arrowstop-1-s { background-position: -224px -32px; } 994 | .ui-icon-arrowstop-1-w { background-position: -240px -32px; } 995 | .ui-icon-arrowthick-1-n { background-position: 0 -48px; } 996 | .ui-icon-arrowthick-1-ne { background-position: -16px -48px; } 997 | .ui-icon-arrowthick-1-e { background-position: -32px -48px; } 998 | .ui-icon-arrowthick-1-se { background-position: -48px -48px; } 999 | .ui-icon-arrowthick-1-s { background-position: -64px -48px; } 1000 | .ui-icon-arrowthick-1-sw { background-position: -80px -48px; } 1001 | .ui-icon-arrowthick-1-w { background-position: -96px -48px; } 1002 | .ui-icon-arrowthick-1-nw { background-position: -112px -48px; } 1003 | .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } 1004 | .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } 1005 | .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } 1006 | .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } 1007 | .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } 1008 | .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } 1009 | .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } 1010 | .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } 1011 | .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } 1012 | .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } 1013 | .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } 1014 | .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } 1015 | .ui-icon-arrowreturn-1-w { background-position: -64px -64px; } 1016 | .ui-icon-arrowreturn-1-n { background-position: -80px -64px; } 1017 | .ui-icon-arrowreturn-1-e { background-position: -96px -64px; } 1018 | .ui-icon-arrowreturn-1-s { background-position: -112px -64px; } 1019 | .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } 1020 | .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } 1021 | .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } 1022 | .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } 1023 | .ui-icon-arrow-4 { background-position: 0 -80px; } 1024 | .ui-icon-arrow-4-diag { background-position: -16px -80px; } 1025 | .ui-icon-extlink { background-position: -32px -80px; } 1026 | .ui-icon-newwin { background-position: -48px -80px; } 1027 | .ui-icon-refresh { background-position: -64px -80px; } 1028 | .ui-icon-shuffle { background-position: -80px -80px; } 1029 | .ui-icon-transfer-e-w { background-position: -96px -80px; } 1030 | .ui-icon-transferthick-e-w { background-position: -112px -80px; } 1031 | .ui-icon-folder-collapsed { background-position: 0 -96px; } 1032 | .ui-icon-folder-open { background-position: -16px -96px; } 1033 | .ui-icon-document { background-position: -32px -96px; } 1034 | .ui-icon-document-b { background-position: -48px -96px; } 1035 | .ui-icon-note { background-position: -64px -96px; } 1036 | .ui-icon-mail-closed { background-position: -80px -96px; } 1037 | .ui-icon-mail-open { background-position: -96px -96px; } 1038 | .ui-icon-suitcase { background-position: -112px -96px; } 1039 | .ui-icon-comment { background-position: -128px -96px; } 1040 | .ui-icon-person { background-position: -144px -96px; } 1041 | .ui-icon-print { background-position: -160px -96px; } 1042 | .ui-icon-trash { background-position: -176px -96px; } 1043 | .ui-icon-locked { background-position: -192px -96px; } 1044 | .ui-icon-unlocked { background-position: -208px -96px; } 1045 | .ui-icon-bookmark { background-position: -224px -96px; } 1046 | .ui-icon-tag { background-position: -240px -96px; } 1047 | .ui-icon-home { background-position: 0 -112px; } 1048 | .ui-icon-flag { background-position: -16px -112px; } 1049 | .ui-icon-calendar { background-position: -32px -112px; } 1050 | .ui-icon-cart { background-position: -48px -112px; } 1051 | .ui-icon-pencil { background-position: -64px -112px; } 1052 | .ui-icon-clock { background-position: -80px -112px; } 1053 | .ui-icon-disk { background-position: -96px -112px; } 1054 | .ui-icon-calculator { background-position: -112px -112px; } 1055 | .ui-icon-zoomin { background-position: -128px -112px; } 1056 | .ui-icon-zoomout { background-position: -144px -112px; } 1057 | .ui-icon-search { background-position: -160px -112px; } 1058 | .ui-icon-wrench { background-position: -176px -112px; } 1059 | .ui-icon-gear { background-position: -192px -112px; } 1060 | .ui-icon-heart { background-position: -208px -112px; } 1061 | .ui-icon-star { background-position: -224px -112px; } 1062 | .ui-icon-link { background-position: -240px -112px; } 1063 | .ui-icon-cancel { background-position: 0 -128px; } 1064 | .ui-icon-plus { background-position: -16px -128px; } 1065 | .ui-icon-plusthick { background-position: -32px -128px; } 1066 | .ui-icon-minus { background-position: -48px -128px; } 1067 | .ui-icon-minusthick { background-position: -64px -128px; } 1068 | .ui-icon-close { background-position: -80px -128px; } 1069 | .ui-icon-closethick { background-position: -96px -128px; } 1070 | .ui-icon-key { background-position: -112px -128px; } 1071 | .ui-icon-lightbulb { background-position: -128px -128px; } 1072 | .ui-icon-scissors { background-position: -144px -128px; } 1073 | .ui-icon-clipboard { background-position: -160px -128px; } 1074 | .ui-icon-copy { background-position: -176px -128px; } 1075 | .ui-icon-contact { background-position: -192px -128px; } 1076 | .ui-icon-image { background-position: -208px -128px; } 1077 | .ui-icon-video { background-position: -224px -128px; } 1078 | .ui-icon-script { background-position: -240px -128px; } 1079 | .ui-icon-alert { background-position: 0 -144px; } 1080 | .ui-icon-info { background-position: -16px -144px; } 1081 | .ui-icon-notice { background-position: -32px -144px; } 1082 | .ui-icon-help { background-position: -48px -144px; } 1083 | .ui-icon-check { background-position: -64px -144px; } 1084 | .ui-icon-bullet { background-position: -80px -144px; } 1085 | .ui-icon-radio-on { background-position: -96px -144px; } 1086 | .ui-icon-radio-off { background-position: -112px -144px; } 1087 | .ui-icon-pin-w { background-position: -128px -144px; } 1088 | .ui-icon-pin-s { background-position: -144px -144px; } 1089 | .ui-icon-play { background-position: 0 -160px; } 1090 | .ui-icon-pause { background-position: -16px -160px; } 1091 | .ui-icon-seek-next { background-position: -32px -160px; } 1092 | .ui-icon-seek-prev { background-position: -48px -160px; } 1093 | .ui-icon-seek-end { background-position: -64px -160px; } 1094 | .ui-icon-seek-start { background-position: -80px -160px; } 1095 | /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ 1096 | .ui-icon-seek-first { background-position: -80px -160px; } 1097 | .ui-icon-stop { background-position: -96px -160px; } 1098 | .ui-icon-eject { background-position: -112px -160px; } 1099 | .ui-icon-volume-off { background-position: -128px -160px; } 1100 | .ui-icon-volume-on { background-position: -144px -160px; } 1101 | .ui-icon-power { background-position: 0 -176px; } 1102 | .ui-icon-signal-diag { background-position: -16px -176px; } 1103 | .ui-icon-signal { background-position: -32px -176px; } 1104 | .ui-icon-battery-0 { background-position: -48px -176px; } 1105 | .ui-icon-battery-1 { background-position: -64px -176px; } 1106 | .ui-icon-battery-2 { background-position: -80px -176px; } 1107 | .ui-icon-battery-3 { background-position: -96px -176px; } 1108 | .ui-icon-circle-plus { background-position: 0 -192px; } 1109 | .ui-icon-circle-minus { background-position: -16px -192px; } 1110 | .ui-icon-circle-close { background-position: -32px -192px; } 1111 | .ui-icon-circle-triangle-e { background-position: -48px -192px; } 1112 | .ui-icon-circle-triangle-s { background-position: -64px -192px; } 1113 | .ui-icon-circle-triangle-w { background-position: -80px -192px; } 1114 | .ui-icon-circle-triangle-n { background-position: -96px -192px; } 1115 | .ui-icon-circle-arrow-e { background-position: -112px -192px; } 1116 | .ui-icon-circle-arrow-s { background-position: -128px -192px; } 1117 | .ui-icon-circle-arrow-w { background-position: -144px -192px; } 1118 | .ui-icon-circle-arrow-n { background-position: -160px -192px; } 1119 | .ui-icon-circle-zoomin { background-position: -176px -192px; } 1120 | .ui-icon-circle-zoomout { background-position: -192px -192px; } 1121 | .ui-icon-circle-check { background-position: -208px -192px; } 1122 | .ui-icon-circlesmall-plus { background-position: 0 -208px; } 1123 | .ui-icon-circlesmall-minus { background-position: -16px -208px; } 1124 | .ui-icon-circlesmall-close { background-position: -32px -208px; } 1125 | .ui-icon-squaresmall-plus { background-position: -48px -208px; } 1126 | .ui-icon-squaresmall-minus { background-position: -64px -208px; } 1127 | .ui-icon-squaresmall-close { background-position: -80px -208px; } 1128 | .ui-icon-grip-dotted-vertical { background-position: 0 -224px; } 1129 | .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } 1130 | .ui-icon-grip-solid-vertical { background-position: -32px -224px; } 1131 | .ui-icon-grip-solid-horizontal { background-position: -48px -224px; } 1132 | .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } 1133 | .ui-icon-grip-diagonal-se { background-position: -80px -224px; } 1134 | 1135 | 1136 | /* Misc visuals 1137 | ----------------------------------*/ 1138 | 1139 | /* Corner radius */ 1140 | .ui-corner-all, 1141 | .ui-corner-top, 1142 | .ui-corner-left, 1143 | .ui-corner-tl { 1144 | border-top-left-radius: 4px; 1145 | } 1146 | .ui-corner-all, 1147 | .ui-corner-top, 1148 | .ui-corner-right, 1149 | .ui-corner-tr { 1150 | border-top-right-radius: 4px; 1151 | } 1152 | .ui-corner-all, 1153 | .ui-corner-bottom, 1154 | .ui-corner-left, 1155 | .ui-corner-bl { 1156 | border-bottom-left-radius: 4px; 1157 | } 1158 | .ui-corner-all, 1159 | .ui-corner-bottom, 1160 | .ui-corner-right, 1161 | .ui-corner-br { 1162 | border-bottom-right-radius: 4px; 1163 | } 1164 | 1165 | /* Overlays */ 1166 | .ui-widget-overlay { 1167 | background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; 1168 | opacity: .3; 1169 | filter: Alpha(Opacity=30); 1170 | } 1171 | .ui-widget-shadow { 1172 | margin: -8px 0 0 -8px; 1173 | padding: 8px; 1174 | background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; 1175 | opacity: .3; 1176 | filter: Alpha(Opacity=30); 1177 | border-radius: 8px; 1178 | } 1179 | -------------------------------------------------------------------------------- /static/css/stereoui.css: -------------------------------------------------------------------------------- 1 | #slider-fps { 2 | width: 250px; 3 | float: left; 4 | } 5 | 6 | #slider-fps-value { 7 | float: right; 8 | } 9 | 10 | #common-controls { 11 | overflow: hidden; 12 | } 13 | 14 | #love-song { 15 | cursor: pointer; 16 | } 17 | 18 | #ban-song { 19 | cursor: pointer; 20 | } 21 | 22 | #now-playing-station-select { 23 | outline: 0px; 24 | border: 0px; 25 | background: #f6f7f8; 26 | } 27 | 28 | .btn-single-color { 29 | margin-top: 10px; 30 | width: 100px; 31 | } 32 | 33 | .icon-single-color { 34 | display: none; 35 | } 36 | 37 | .icon-custom-color { 38 | display: none; 39 | } 40 | 41 | .custom-color-button { 42 | margin-top: 10px; 43 | width: 100px; 44 | } 45 | 46 | #custom-count-div { 47 | margin-top: 10px; 48 | } 49 | 50 | .box { 51 | margin-left: 10px; 52 | margin-top: 10px; 53 | box-shadow: 0 0 0 1px rgba(0,0,0,0.07); 54 | background-clip: padding-box; 55 | border-top-left-radius: 4px; 56 | border-top-right-radius: 4px; 57 | border-bottom-left-radius: 4px; 58 | border-bottom-right-radius: 4px; 59 | background: #f6f7f8; 60 | padding: 10px 12px; 61 | border: 0; 62 | max-width: 450px; 63 | } 64 | 65 | .now-playing-label { 66 | text-align: right; 67 | padding-right: 10px; 68 | } 69 | 70 | -------------------------------------------------------------------------------- /static/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sbelectronics/pi-dcload/0fa73639a875b69b3137bfe737242e6fc54fd7cd/static/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /static/fonts/glyphicons-halflings-regular.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | -------------------------------------------------------------------------------- /static/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sbelectronics/pi-dcload/0fa73639a875b69b3137bfe737242e6fc54fd7cd/static/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /static/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sbelectronics/pi-dcload/0fa73639a875b69b3137bfe737242e6fc54fd7cd/static/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /static/icons/Thumbs_down_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sbelectronics/pi-dcload/0fa73639a875b69b3137bfe737242e6fc54fd7cd/static/icons/Thumbs_down_32px.png -------------------------------------------------------------------------------- /static/icons/Thumbs_up_32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sbelectronics/pi-dcload/0fa73639a875b69b3137bfe737242e6fc54fd7cd/static/icons/Thumbs_up_32px.png -------------------------------------------------------------------------------- /static/icons/chosen-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sbelectronics/pi-dcload/0fa73639a875b69b3137bfe737242e6fc54fd7cd/static/icons/chosen-sprite.png -------------------------------------------------------------------------------- /static/icons/chosen-sprite@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sbelectronics/pi-dcload/0fa73639a875b69b3137bfe737242e6fc54fd7cd/static/icons/chosen-sprite@2x.png -------------------------------------------------------------------------------- /static/js/dcload.js: -------------------------------------------------------------------------------- 1 | COLORS = ["red", "green", "blue", "white", "magenta", "yellow", "cyan", "black", "orange"]; 2 | 3 | function dcload() { 4 | onPowerOn = function() { 5 | var button_selector = "#power-on"; 6 | var icon_selector = "#icon-power-on"; 7 | console.log("PowerOn"); 8 | $(".btn-power").removeClass("active"); 9 | $(".icon-power").hide(); 10 | $(button_selector).addClass("active"); 11 | $(icon_selector).show(); 12 | /* if (dcload.postUI) { 13 | dcload.setPower(true); 14 | }*/ 15 | } 16 | 17 | onPowerOff = function() { 18 | var button_selector = "#power-off"; 19 | var icon_selector = "#icon-power-off"; 20 | console.log("PowerOff"); 21 | $(".btn-power").removeClass("active"); 22 | $(".icon-power").hide(); 23 | $(button_selector).addClass("active"); 24 | $(icon_selector).show(); 25 | /* if (dcload.postUI) { 26 | dcload.setPower(false); 27 | }*/ 28 | } 29 | 30 | onMaChange = function() { 31 | ma = $("#slider-ma").slider("value"); 32 | a = parseFloat(ma)/1000 33 | $("#ma-setPoint").text(a.toFixed(3) + " A"); 34 | if (dcload.postUI) { 35 | dcload.sendDesiredMa(ma); 36 | dcload.ignoreOne = true; 37 | } 38 | } 39 | 40 | onMaSlide = function(event, ui) { 41 | ma = ui.value; 42 | a = parseFloat(ma)/1000 43 | $("#ma-setPoint").text(a.toFixed(3) + " A"); 44 | } 45 | 46 | onMaStartSlide = function() { 47 | console.log("startSlide"); 48 | dcload.maSliding=true; 49 | } 50 | 51 | onMaStopSlide = function() { 52 | console.log("stopSlide"); 53 | dcload.maSliding=false; 54 | } 55 | 56 | sendDesiredMa = function(value) { 57 | $.ajax({url: "/dcload/setDesiredMa?value=" + value}); 58 | } 59 | 60 | maPlus = function(value) { 61 | ma = parseFloat($("#slider-ma").slider("value")); 62 | ma = Math.min(10000, ma+value) 63 | $("#slider-ma").slider({value: ma}); 64 | dcload.ignoreOne = true; 65 | } 66 | 67 | maMinus = function(value) { 68 | ma = parseFloat($("#slider-ma").slider("value")); 69 | ma = Math.max(0, ma-value) 70 | $("#slider-ma").slider({value: ma}); 71 | dcload.ignoreOne = true; 72 | } 73 | 74 | maSet = function(value) { 75 | ma = parseFloat($("#ma-set-edit").val())*1000; 76 | $("#slider-ma").slider({value: ma}); 77 | dcload.ignoreOne = true; 78 | } 79 | 80 | 81 | initButtons = function() { 82 | $("#slider-ma").slider({min: 1, 83 | max:10000, 84 | slide: this.onMaSlide, 85 | change: this.onMaChange, 86 | start: this.onMaStartSlide, 87 | stop: this.onMaStopSlide}); 88 | 89 | $("#ma-plus-1").click(function() { dcload.maPlus(1); }); 90 | $("#ma-plus-10").click(function() { dcload.maPlus(10); }); 91 | $("#ma-plus-100").click(function() { dcload.maPlus(100); }); 92 | $("#ma-plus-1000").click(function() { dcload.maPlus(1000); }); 93 | 94 | $("#ma-minus-1").click(function() { dcload.maMinus(1); }); 95 | $("#ma-minus-10").click(function() { dcload.maMinus(10); }); 96 | $("#ma-minus-100").click(function() { dcload.maMinus(100); }); 97 | $("#ma-minus-1000").click(function() { dcload.maMinus(1000); }); 98 | 99 | $("#ma-set").click(function() { dcload.maSet(); }); 100 | 101 | $("#power-on").click(function() { dcload.onPowerOn(); }); 102 | $("#power-off").click(function() { dcload.onPowerOff(); }); 103 | 104 | } 105 | 106 | parseStatus = function(settings) { 107 | //console.log(settings); 108 | this.postUI = false; 109 | try { 110 | if (dcload.ignoreOne) { 111 | dcload.ignoreOne = false; 112 | } else { 113 | if (!dcload.maSliding) { 114 | $("#slider-ma").slider({value: settings.desired_ma}); 115 | } 116 | } 117 | if (settings["actual_ma"]) { 118 | a = settings["actual_ma"]/1000.0; 119 | $("#actual-ma").text(a.toFixed(3) + " A"); 120 | } 121 | if (settings["actual_volts"]) { 122 | $("#actual-volts").text(settings["actual_volts"].toFixed(3) + " V"); 123 | } 124 | if (settings["actual_watts"]) { 125 | $("#actual-watts").text(settings["actual_watts"].toFixed(2) + " W"); 126 | } 127 | if (settings["actual_temp"]) { 128 | $("#actual-temp").text(settings["actual_temp"].toFixed(1) + " C"); 129 | } 130 | if (settings["power"]) { 131 | if (! $("#power-on").hasClass("active") ) { 132 | $("#icon-power-on").click(); 133 | } 134 | } else { 135 | if (! $("#power-off").hasClass("active") ) { 136 | $("#icon-power-off").click(); 137 | } 138 | } 139 | } 140 | finally { 141 | this.postUI = true; 142 | } 143 | } 144 | 145 | requestStatus = function() { 146 | $.ajax({ 147 | url: "/dcload/getStatus", 148 | dataType : 'json', 149 | type : 'GET', 150 | success: function(newData) { 151 | dcload.parseStatus(newData); 152 | setTimeout("dcload.requestStatus();", 1000); 153 | }, 154 | error: function() { 155 | console.log("error retrieving settings"); 156 | setTimeout("dcload.requestStatus();", 5000); 157 | } 158 | }); 159 | } 160 | 161 | start = function() { 162 | this.postUI = true; 163 | this.initButtons(); 164 | this.requestStatus(); 165 | } 166 | 167 | return this; 168 | } 169 | 170 | $(document).ready(function(){ 171 | dcload = dcload() 172 | dcload.start(); 173 | }); 174 | 175 | -------------------------------------------------------------------------------- /static/js/vendor/chosen.jquery.js: -------------------------------------------------------------------------------- 1 | /*! 2 | Chosen, a Select Box Enhancer for jQuery and Prototype 3 | by Patrick Filler for Harvest, http://getharvest.com 4 | 5 | Version 1.4.2 6 | Full source at https://github.com/harvesthq/chosen 7 | Copyright (c) 2011-2015 Harvest http://getharvest.com 8 | 9 | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md 10 | This file is generated by `grunt build`, do not edit it by hand. 11 | */ 12 | 13 | (function() { 14 | var $, AbstractChosen, Chosen, SelectParser, _ref, 15 | __hasProp = {}.hasOwnProperty, 16 | __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; 17 | 18 | SelectParser = (function() { 19 | function SelectParser() { 20 | this.options_index = 0; 21 | this.parsed = []; 22 | } 23 | 24 | SelectParser.prototype.add_node = function(child) { 25 | if (child.nodeName.toUpperCase() === "OPTGROUP") { 26 | return this.add_group(child); 27 | } else { 28 | return this.add_option(child); 29 | } 30 | }; 31 | 32 | SelectParser.prototype.add_group = function(group) { 33 | var group_position, option, _i, _len, _ref, _results; 34 | group_position = this.parsed.length; 35 | this.parsed.push({ 36 | array_index: group_position, 37 | group: true, 38 | label: this.escapeExpression(group.label), 39 | title: group.title ? group.title : void 0, 40 | children: 0, 41 | disabled: group.disabled, 42 | classes: group.className 43 | }); 44 | _ref = group.childNodes; 45 | _results = []; 46 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 47 | option = _ref[_i]; 48 | _results.push(this.add_option(option, group_position, group.disabled)); 49 | } 50 | return _results; 51 | }; 52 | 53 | SelectParser.prototype.add_option = function(option, group_position, group_disabled) { 54 | if (option.nodeName.toUpperCase() === "OPTION") { 55 | if (option.text !== "") { 56 | if (group_position != null) { 57 | this.parsed[group_position].children += 1; 58 | } 59 | this.parsed.push({ 60 | array_index: this.parsed.length, 61 | options_index: this.options_index, 62 | value: option.value, 63 | text: option.text, 64 | html: option.innerHTML, 65 | title: option.title ? option.title : void 0, 66 | selected: option.selected, 67 | disabled: group_disabled === true ? group_disabled : option.disabled, 68 | group_array_index: group_position, 69 | group_label: group_position != null ? this.parsed[group_position].label : null, 70 | classes: option.className, 71 | style: option.style.cssText 72 | }); 73 | } else { 74 | this.parsed.push({ 75 | array_index: this.parsed.length, 76 | options_index: this.options_index, 77 | empty: true 78 | }); 79 | } 80 | return this.options_index += 1; 81 | } 82 | }; 83 | 84 | SelectParser.prototype.escapeExpression = function(text) { 85 | var map, unsafe_chars; 86 | if ((text == null) || text === false) { 87 | return ""; 88 | } 89 | if (!/[\&\<\>\"\'\`]/.test(text)) { 90 | return text; 91 | } 92 | map = { 93 | "<": "<", 94 | ">": ">", 95 | '"': """, 96 | "'": "'", 97 | "`": "`" 98 | }; 99 | unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g; 100 | return text.replace(unsafe_chars, function(chr) { 101 | return map[chr] || "&"; 102 | }); 103 | }; 104 | 105 | return SelectParser; 106 | 107 | })(); 108 | 109 | SelectParser.select_to_array = function(select) { 110 | var child, parser, _i, _len, _ref; 111 | parser = new SelectParser(); 112 | _ref = select.childNodes; 113 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 114 | child = _ref[_i]; 115 | parser.add_node(child); 116 | } 117 | return parser.parsed; 118 | }; 119 | 120 | AbstractChosen = (function() { 121 | function AbstractChosen(form_field, options) { 122 | this.form_field = form_field; 123 | this.options = options != null ? options : {}; 124 | if (!AbstractChosen.browser_is_supported()) { 125 | return; 126 | } 127 | this.is_multiple = this.form_field.multiple; 128 | this.set_default_text(); 129 | this.set_default_values(); 130 | this.setup(); 131 | this.set_up_html(); 132 | this.register_observers(); 133 | this.on_ready(); 134 | } 135 | 136 | AbstractChosen.prototype.set_default_values = function() { 137 | var _this = this; 138 | this.click_test_action = function(evt) { 139 | return _this.test_active_click(evt); 140 | }; 141 | this.activate_action = function(evt) { 142 | return _this.activate_field(evt); 143 | }; 144 | this.active_field = false; 145 | this.mouse_on_container = false; 146 | this.results_showing = false; 147 | this.result_highlighted = null; 148 | this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false; 149 | this.disable_search_threshold = this.options.disable_search_threshold || 0; 150 | this.disable_search = this.options.disable_search || false; 151 | this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true; 152 | this.group_search = this.options.group_search != null ? this.options.group_search : true; 153 | this.search_contains = this.options.search_contains || false; 154 | this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true; 155 | this.max_selected_options = this.options.max_selected_options || Infinity; 156 | this.inherit_select_classes = this.options.inherit_select_classes || false; 157 | this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true; 158 | this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true; 159 | return this.include_group_label_in_selected = this.options.include_group_label_in_selected || false; 160 | }; 161 | 162 | AbstractChosen.prototype.set_default_text = function() { 163 | if (this.form_field.getAttribute("data-placeholder")) { 164 | this.default_text = this.form_field.getAttribute("data-placeholder"); 165 | } else if (this.is_multiple) { 166 | this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text; 167 | } else { 168 | this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text; 169 | } 170 | return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text; 171 | }; 172 | 173 | AbstractChosen.prototype.choice_label = function(item) { 174 | if (this.include_group_label_in_selected && (item.group_label != null)) { 175 | return "" + item.group_label + "" + item.html; 176 | } else { 177 | return item.html; 178 | } 179 | }; 180 | 181 | AbstractChosen.prototype.mouse_enter = function() { 182 | return this.mouse_on_container = true; 183 | }; 184 | 185 | AbstractChosen.prototype.mouse_leave = function() { 186 | return this.mouse_on_container = false; 187 | }; 188 | 189 | AbstractChosen.prototype.input_focus = function(evt) { 190 | var _this = this; 191 | if (this.is_multiple) { 192 | if (!this.active_field) { 193 | return setTimeout((function() { 194 | return _this.container_mousedown(); 195 | }), 50); 196 | } 197 | } else { 198 | if (!this.active_field) { 199 | return this.activate_field(); 200 | } 201 | } 202 | }; 203 | 204 | AbstractChosen.prototype.input_blur = function(evt) { 205 | var _this = this; 206 | if (!this.mouse_on_container) { 207 | this.active_field = false; 208 | return setTimeout((function() { 209 | return _this.blur_test(); 210 | }), 100); 211 | } 212 | }; 213 | 214 | AbstractChosen.prototype.results_option_build = function(options) { 215 | var content, data, _i, _len, _ref; 216 | content = ''; 217 | _ref = this.results_data; 218 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 219 | data = _ref[_i]; 220 | if (data.group) { 221 | content += this.result_add_group(data); 222 | } else { 223 | content += this.result_add_option(data); 224 | } 225 | if (options != null ? options.first : void 0) { 226 | if (data.selected && this.is_multiple) { 227 | this.choice_build(data); 228 | } else if (data.selected && !this.is_multiple) { 229 | this.single_set_selected_text(this.choice_label(data)); 230 | } 231 | } 232 | } 233 | return content; 234 | }; 235 | 236 | AbstractChosen.prototype.result_add_option = function(option) { 237 | var classes, option_el; 238 | if (!option.search_match) { 239 | return ''; 240 | } 241 | if (!this.include_option_in_results(option)) { 242 | return ''; 243 | } 244 | classes = []; 245 | if (!option.disabled && !(option.selected && this.is_multiple)) { 246 | classes.push("active-result"); 247 | } 248 | if (option.disabled && !(option.selected && this.is_multiple)) { 249 | classes.push("disabled-result"); 250 | } 251 | if (option.selected) { 252 | classes.push("result-selected"); 253 | } 254 | if (option.group_array_index != null) { 255 | classes.push("group-option"); 256 | } 257 | if (option.classes !== "") { 258 | classes.push(option.classes); 259 | } 260 | option_el = document.createElement("li"); 261 | option_el.className = classes.join(" "); 262 | option_el.style.cssText = option.style; 263 | option_el.setAttribute("data-option-array-index", option.array_index); 264 | option_el.innerHTML = option.search_text; 265 | if (option.title) { 266 | option_el.title = option.title; 267 | } 268 | return this.outerHTML(option_el); 269 | }; 270 | 271 | AbstractChosen.prototype.result_add_group = function(group) { 272 | var classes, group_el; 273 | if (!(group.search_match || group.group_match)) { 274 | return ''; 275 | } 276 | if (!(group.active_options > 0)) { 277 | return ''; 278 | } 279 | classes = []; 280 | classes.push("group-result"); 281 | if (group.classes) { 282 | classes.push(group.classes); 283 | } 284 | group_el = document.createElement("li"); 285 | group_el.className = classes.join(" "); 286 | group_el.innerHTML = group.search_text; 287 | if (group.title) { 288 | group_el.title = group.title; 289 | } 290 | return this.outerHTML(group_el); 291 | }; 292 | 293 | AbstractChosen.prototype.results_update_field = function() { 294 | this.set_default_text(); 295 | if (!this.is_multiple) { 296 | this.results_reset_cleanup(); 297 | } 298 | this.result_clear_highlight(); 299 | this.results_build(); 300 | if (this.results_showing) { 301 | return this.winnow_results(); 302 | } 303 | }; 304 | 305 | AbstractChosen.prototype.reset_single_select_options = function() { 306 | var result, _i, _len, _ref, _results; 307 | _ref = this.results_data; 308 | _results = []; 309 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 310 | result = _ref[_i]; 311 | if (result.selected) { 312 | _results.push(result.selected = false); 313 | } else { 314 | _results.push(void 0); 315 | } 316 | } 317 | return _results; 318 | }; 319 | 320 | AbstractChosen.prototype.results_toggle = function() { 321 | if (this.results_showing) { 322 | return this.results_hide(); 323 | } else { 324 | return this.results_show(); 325 | } 326 | }; 327 | 328 | AbstractChosen.prototype.results_search = function(evt) { 329 | if (this.results_showing) { 330 | return this.winnow_results(); 331 | } else { 332 | return this.results_show(); 333 | } 334 | }; 335 | 336 | AbstractChosen.prototype.winnow_results = function() { 337 | var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref; 338 | this.no_results_clear(); 339 | results = 0; 340 | searchText = this.get_search_text(); 341 | escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); 342 | zregex = new RegExp(escapedSearchText, 'i'); 343 | regex = this.get_search_regex(escapedSearchText); 344 | _ref = this.results_data; 345 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 346 | option = _ref[_i]; 347 | option.search_match = false; 348 | results_group = null; 349 | if (this.include_option_in_results(option)) { 350 | if (option.group) { 351 | option.group_match = false; 352 | option.active_options = 0; 353 | } 354 | if ((option.group_array_index != null) && this.results_data[option.group_array_index]) { 355 | results_group = this.results_data[option.group_array_index]; 356 | if (results_group.active_options === 0 && results_group.search_match) { 357 | results += 1; 358 | } 359 | results_group.active_options += 1; 360 | } 361 | option.search_text = option.group ? option.label : option.html; 362 | if (!(option.group && !this.group_search)) { 363 | option.search_match = this.search_string_match(option.search_text, regex); 364 | if (option.search_match && !option.group) { 365 | results += 1; 366 | } 367 | if (option.search_match) { 368 | if (searchText.length) { 369 | startpos = option.search_text.search(zregex); 370 | text = option.search_text.substr(0, startpos + searchText.length) + '' + option.search_text.substr(startpos + searchText.length); 371 | option.search_text = text.substr(0, startpos) + '' + text.substr(startpos); 372 | } 373 | if (results_group != null) { 374 | results_group.group_match = true; 375 | } 376 | } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) { 377 | option.search_match = true; 378 | } 379 | } 380 | } 381 | } 382 | this.result_clear_highlight(); 383 | if (results < 1 && searchText.length) { 384 | this.update_results_content(""); 385 | return this.no_results(searchText); 386 | } else { 387 | this.update_results_content(this.results_option_build()); 388 | return this.winnow_results_set_highlight(); 389 | } 390 | }; 391 | 392 | AbstractChosen.prototype.get_search_regex = function(escaped_search_string) { 393 | var regex_anchor; 394 | regex_anchor = this.search_contains ? "" : "^"; 395 | return new RegExp(regex_anchor + escaped_search_string, 'i'); 396 | }; 397 | 398 | AbstractChosen.prototype.search_string_match = function(search_string, regex) { 399 | var part, parts, _i, _len; 400 | if (regex.test(search_string)) { 401 | return true; 402 | } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) { 403 | parts = search_string.replace(/\[|\]/g, "").split(" "); 404 | if (parts.length) { 405 | for (_i = 0, _len = parts.length; _i < _len; _i++) { 406 | part = parts[_i]; 407 | if (regex.test(part)) { 408 | return true; 409 | } 410 | } 411 | } 412 | } 413 | }; 414 | 415 | AbstractChosen.prototype.choices_count = function() { 416 | var option, _i, _len, _ref; 417 | if (this.selected_option_count != null) { 418 | return this.selected_option_count; 419 | } 420 | this.selected_option_count = 0; 421 | _ref = this.form_field.options; 422 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 423 | option = _ref[_i]; 424 | if (option.selected) { 425 | this.selected_option_count += 1; 426 | } 427 | } 428 | return this.selected_option_count; 429 | }; 430 | 431 | AbstractChosen.prototype.choices_click = function(evt) { 432 | evt.preventDefault(); 433 | if (!(this.results_showing || this.is_disabled)) { 434 | return this.results_show(); 435 | } 436 | }; 437 | 438 | AbstractChosen.prototype.keyup_checker = function(evt) { 439 | var stroke, _ref; 440 | stroke = (_ref = evt.which) != null ? _ref : evt.keyCode; 441 | this.search_field_scale(); 442 | switch (stroke) { 443 | case 8: 444 | if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) { 445 | return this.keydown_backstroke(); 446 | } else if (!this.pending_backstroke) { 447 | this.result_clear_highlight(); 448 | return this.results_search(); 449 | } 450 | break; 451 | case 13: 452 | evt.preventDefault(); 453 | if (this.results_showing) { 454 | return this.result_select(evt); 455 | } 456 | break; 457 | case 27: 458 | if (this.results_showing) { 459 | this.results_hide(); 460 | } 461 | return true; 462 | case 9: 463 | case 38: 464 | case 40: 465 | case 16: 466 | case 91: 467 | case 17: 468 | break; 469 | default: 470 | return this.results_search(); 471 | } 472 | }; 473 | 474 | AbstractChosen.prototype.clipboard_event_checker = function(evt) { 475 | var _this = this; 476 | return setTimeout((function() { 477 | return _this.results_search(); 478 | }), 50); 479 | }; 480 | 481 | AbstractChosen.prototype.container_width = function() { 482 | if (this.options.width != null) { 483 | return this.options.width; 484 | } else { 485 | return "" + this.form_field.offsetWidth + "px"; 486 | } 487 | }; 488 | 489 | AbstractChosen.prototype.include_option_in_results = function(option) { 490 | if (this.is_multiple && (!this.display_selected_options && option.selected)) { 491 | return false; 492 | } 493 | if (!this.display_disabled_options && option.disabled) { 494 | return false; 495 | } 496 | if (option.empty) { 497 | return false; 498 | } 499 | return true; 500 | }; 501 | 502 | AbstractChosen.prototype.search_results_touchstart = function(evt) { 503 | this.touch_started = true; 504 | return this.search_results_mouseover(evt); 505 | }; 506 | 507 | AbstractChosen.prototype.search_results_touchmove = function(evt) { 508 | this.touch_started = false; 509 | return this.search_results_mouseout(evt); 510 | }; 511 | 512 | AbstractChosen.prototype.search_results_touchend = function(evt) { 513 | if (this.touch_started) { 514 | return this.search_results_mouseup(evt); 515 | } 516 | }; 517 | 518 | AbstractChosen.prototype.outerHTML = function(element) { 519 | var tmp; 520 | if (element.outerHTML) { 521 | return element.outerHTML; 522 | } 523 | tmp = document.createElement("div"); 524 | tmp.appendChild(element); 525 | return tmp.innerHTML; 526 | }; 527 | 528 | AbstractChosen.browser_is_supported = function() { 529 | if (window.navigator.appName === "Microsoft Internet Explorer") { 530 | return document.documentMode >= 8; 531 | } 532 | if (/iP(od|hone)/i.test(window.navigator.userAgent)) { 533 | return false; 534 | } 535 | if (/Android/i.test(window.navigator.userAgent)) { 536 | if (/Mobile/i.test(window.navigator.userAgent)) { 537 | return false; 538 | } 539 | } 540 | return true; 541 | }; 542 | 543 | AbstractChosen.default_multiple_text = "Select Some Options"; 544 | 545 | AbstractChosen.default_single_text = "Select an Option"; 546 | 547 | AbstractChosen.default_no_result_text = "No results match"; 548 | 549 | return AbstractChosen; 550 | 551 | })(); 552 | 553 | $ = jQuery; 554 | 555 | $.fn.extend({ 556 | chosen: function(options) { 557 | if (!AbstractChosen.browser_is_supported()) { 558 | return this; 559 | } 560 | return this.each(function(input_field) { 561 | var $this, chosen; 562 | $this = $(this); 563 | chosen = $this.data('chosen'); 564 | if (options === 'destroy' && chosen instanceof Chosen) { 565 | chosen.destroy(); 566 | } else if (!(chosen instanceof Chosen)) { 567 | $this.data('chosen', new Chosen(this, options)); 568 | } 569 | }); 570 | } 571 | }); 572 | 573 | Chosen = (function(_super) { 574 | __extends(Chosen, _super); 575 | 576 | function Chosen() { 577 | _ref = Chosen.__super__.constructor.apply(this, arguments); 578 | return _ref; 579 | } 580 | 581 | Chosen.prototype.setup = function() { 582 | this.form_field_jq = $(this.form_field); 583 | this.current_selectedIndex = this.form_field.selectedIndex; 584 | return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl"); 585 | }; 586 | 587 | Chosen.prototype.set_up_html = function() { 588 | var container_classes, container_props; 589 | container_classes = ["chosen-container"]; 590 | container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single")); 591 | if (this.inherit_select_classes && this.form_field.className) { 592 | container_classes.push(this.form_field.className); 593 | } 594 | if (this.is_rtl) { 595 | container_classes.push("chosen-rtl"); 596 | } 597 | container_props = { 598 | 'class': container_classes.join(' '), 599 | 'style': "width: " + (this.container_width()) + ";", 600 | 'title': this.form_field.title 601 | }; 602 | if (this.form_field.id.length) { 603 | container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen"; 604 | } 605 | this.container = $("
", container_props); 606 | if (this.is_multiple) { 607 | this.container.html('
    '); 608 | } else { 609 | this.container.html('' + this.default_text + '
      '); 610 | } 611 | this.form_field_jq.hide().after(this.container); 612 | this.dropdown = this.container.find('div.chosen-drop').first(); 613 | this.search_field = this.container.find('input').first(); 614 | this.search_results = this.container.find('ul.chosen-results').first(); 615 | this.search_field_scale(); 616 | this.search_no_results = this.container.find('li.no-results').first(); 617 | if (this.is_multiple) { 618 | this.search_choices = this.container.find('ul.chosen-choices').first(); 619 | this.search_container = this.container.find('li.search-field').first(); 620 | } else { 621 | this.search_container = this.container.find('div.chosen-search').first(); 622 | this.selected_item = this.container.find('.chosen-single').first(); 623 | } 624 | this.results_build(); 625 | this.set_tab_index(); 626 | return this.set_label_behavior(); 627 | }; 628 | 629 | Chosen.prototype.on_ready = function() { 630 | return this.form_field_jq.trigger("chosen:ready", { 631 | chosen: this 632 | }); 633 | }; 634 | 635 | Chosen.prototype.register_observers = function() { 636 | var _this = this; 637 | this.container.bind('touchstart.chosen', function(evt) { 638 | _this.container_mousedown(evt); 639 | return evt.preventDefault(); 640 | }); 641 | this.container.bind('touchend.chosen', function(evt) { 642 | _this.container_mouseup(evt); 643 | return evt.preventDefault(); 644 | }); 645 | this.container.bind('mousedown.chosen', function(evt) { 646 | _this.container_mousedown(evt); 647 | }); 648 | this.container.bind('mouseup.chosen', function(evt) { 649 | _this.container_mouseup(evt); 650 | }); 651 | this.container.bind('mouseenter.chosen', function(evt) { 652 | _this.mouse_enter(evt); 653 | }); 654 | this.container.bind('mouseleave.chosen', function(evt) { 655 | _this.mouse_leave(evt); 656 | }); 657 | this.search_results.bind('mouseup.chosen', function(evt) { 658 | _this.search_results_mouseup(evt); 659 | }); 660 | this.search_results.bind('mouseover.chosen', function(evt) { 661 | _this.search_results_mouseover(evt); 662 | }); 663 | this.search_results.bind('mouseout.chosen', function(evt) { 664 | _this.search_results_mouseout(evt); 665 | }); 666 | this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) { 667 | _this.search_results_mousewheel(evt); 668 | }); 669 | this.search_results.bind('touchstart.chosen', function(evt) { 670 | _this.search_results_touchstart(evt); 671 | }); 672 | this.search_results.bind('touchmove.chosen', function(evt) { 673 | _this.search_results_touchmove(evt); 674 | }); 675 | this.search_results.bind('touchend.chosen', function(evt) { 676 | _this.search_results_touchend(evt); 677 | }); 678 | this.form_field_jq.bind("chosen:updated.chosen", function(evt) { 679 | _this.results_update_field(evt); 680 | }); 681 | this.form_field_jq.bind("chosen:activate.chosen", function(evt) { 682 | _this.activate_field(evt); 683 | }); 684 | this.form_field_jq.bind("chosen:open.chosen", function(evt) { 685 | _this.container_mousedown(evt); 686 | }); 687 | this.form_field_jq.bind("chosen:close.chosen", function(evt) { 688 | _this.input_blur(evt); 689 | }); 690 | this.search_field.bind('blur.chosen', function(evt) { 691 | _this.input_blur(evt); 692 | }); 693 | this.search_field.bind('keyup.chosen', function(evt) { 694 | _this.keyup_checker(evt); 695 | }); 696 | this.search_field.bind('keydown.chosen', function(evt) { 697 | _this.keydown_checker(evt); 698 | }); 699 | this.search_field.bind('focus.chosen', function(evt) { 700 | _this.input_focus(evt); 701 | }); 702 | this.search_field.bind('cut.chosen', function(evt) { 703 | _this.clipboard_event_checker(evt); 704 | }); 705 | this.search_field.bind('paste.chosen', function(evt) { 706 | _this.clipboard_event_checker(evt); 707 | }); 708 | if (this.is_multiple) { 709 | return this.search_choices.bind('click.chosen', function(evt) { 710 | _this.choices_click(evt); 711 | }); 712 | } else { 713 | return this.container.bind('click.chosen', function(evt) { 714 | evt.preventDefault(); 715 | }); 716 | } 717 | }; 718 | 719 | Chosen.prototype.destroy = function() { 720 | $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action); 721 | if (this.search_field[0].tabIndex) { 722 | this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex; 723 | } 724 | this.container.remove(); 725 | this.form_field_jq.removeData('chosen'); 726 | return this.form_field_jq.show(); 727 | }; 728 | 729 | Chosen.prototype.search_field_disabled = function() { 730 | this.is_disabled = this.form_field_jq[0].disabled; 731 | if (this.is_disabled) { 732 | this.container.addClass('chosen-disabled'); 733 | this.search_field[0].disabled = true; 734 | if (!this.is_multiple) { 735 | this.selected_item.unbind("focus.chosen", this.activate_action); 736 | } 737 | return this.close_field(); 738 | } else { 739 | this.container.removeClass('chosen-disabled'); 740 | this.search_field[0].disabled = false; 741 | if (!this.is_multiple) { 742 | return this.selected_item.bind("focus.chosen", this.activate_action); 743 | } 744 | } 745 | }; 746 | 747 | Chosen.prototype.container_mousedown = function(evt) { 748 | if (!this.is_disabled) { 749 | if (evt && evt.type === "mousedown" && !this.results_showing) { 750 | evt.preventDefault(); 751 | } 752 | if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) { 753 | if (!this.active_field) { 754 | if (this.is_multiple) { 755 | this.search_field.val(""); 756 | } 757 | $(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action); 758 | this.results_show(); 759 | } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) { 760 | evt.preventDefault(); 761 | this.results_toggle(); 762 | } 763 | return this.activate_field(); 764 | } 765 | } 766 | }; 767 | 768 | Chosen.prototype.container_mouseup = function(evt) { 769 | if (evt.target.nodeName === "ABBR" && !this.is_disabled) { 770 | return this.results_reset(evt); 771 | } 772 | }; 773 | 774 | Chosen.prototype.search_results_mousewheel = function(evt) { 775 | var delta; 776 | if (evt.originalEvent) { 777 | delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail; 778 | } 779 | if (delta != null) { 780 | evt.preventDefault(); 781 | if (evt.type === 'DOMMouseScroll') { 782 | delta = delta * 40; 783 | } 784 | return this.search_results.scrollTop(delta + this.search_results.scrollTop()); 785 | } 786 | }; 787 | 788 | Chosen.prototype.blur_test = function(evt) { 789 | if (!this.active_field && this.container.hasClass("chosen-container-active")) { 790 | return this.close_field(); 791 | } 792 | }; 793 | 794 | Chosen.prototype.close_field = function() { 795 | $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action); 796 | this.active_field = false; 797 | this.results_hide(); 798 | this.container.removeClass("chosen-container-active"); 799 | this.clear_backstroke(); 800 | this.show_search_field_default(); 801 | return this.search_field_scale(); 802 | }; 803 | 804 | Chosen.prototype.activate_field = function() { 805 | this.container.addClass("chosen-container-active"); 806 | this.active_field = true; 807 | this.search_field.val(this.search_field.val()); 808 | return this.search_field.focus(); 809 | }; 810 | 811 | Chosen.prototype.test_active_click = function(evt) { 812 | var active_container; 813 | active_container = $(evt.target).closest('.chosen-container'); 814 | if (active_container.length && this.container[0] === active_container[0]) { 815 | return this.active_field = true; 816 | } else { 817 | return this.close_field(); 818 | } 819 | }; 820 | 821 | Chosen.prototype.results_build = function() { 822 | this.parsing = true; 823 | this.selected_option_count = null; 824 | this.results_data = SelectParser.select_to_array(this.form_field); 825 | if (this.is_multiple) { 826 | this.search_choices.find("li.search-choice").remove(); 827 | } else if (!this.is_multiple) { 828 | this.single_set_selected_text(); 829 | if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) { 830 | this.search_field[0].readOnly = true; 831 | this.container.addClass("chosen-container-single-nosearch"); 832 | } else { 833 | this.search_field[0].readOnly = false; 834 | this.container.removeClass("chosen-container-single-nosearch"); 835 | } 836 | } 837 | this.update_results_content(this.results_option_build({ 838 | first: true 839 | })); 840 | this.search_field_disabled(); 841 | this.show_search_field_default(); 842 | this.search_field_scale(); 843 | return this.parsing = false; 844 | }; 845 | 846 | Chosen.prototype.result_do_highlight = function(el) { 847 | var high_bottom, high_top, maxHeight, visible_bottom, visible_top; 848 | if (el.length) { 849 | this.result_clear_highlight(); 850 | this.result_highlight = el; 851 | this.result_highlight.addClass("highlighted"); 852 | maxHeight = parseInt(this.search_results.css("maxHeight"), 10); 853 | visible_top = this.search_results.scrollTop(); 854 | visible_bottom = maxHeight + visible_top; 855 | high_top = this.result_highlight.position().top + this.search_results.scrollTop(); 856 | high_bottom = high_top + this.result_highlight.outerHeight(); 857 | if (high_bottom >= visible_bottom) { 858 | return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0); 859 | } else if (high_top < visible_top) { 860 | return this.search_results.scrollTop(high_top); 861 | } 862 | } 863 | }; 864 | 865 | Chosen.prototype.result_clear_highlight = function() { 866 | if (this.result_highlight) { 867 | this.result_highlight.removeClass("highlighted"); 868 | } 869 | return this.result_highlight = null; 870 | }; 871 | 872 | Chosen.prototype.results_show = function() { 873 | if (this.is_multiple && this.max_selected_options <= this.choices_count()) { 874 | this.form_field_jq.trigger("chosen:maxselected", { 875 | chosen: this 876 | }); 877 | return false; 878 | } 879 | this.container.addClass("chosen-with-drop"); 880 | this.results_showing = true; 881 | this.search_field.focus(); 882 | this.search_field.val(this.search_field.val()); 883 | this.winnow_results(); 884 | return this.form_field_jq.trigger("chosen:showing_dropdown", { 885 | chosen: this 886 | }); 887 | }; 888 | 889 | Chosen.prototype.update_results_content = function(content) { 890 | return this.search_results.html(content); 891 | }; 892 | 893 | Chosen.prototype.results_hide = function() { 894 | if (this.results_showing) { 895 | this.result_clear_highlight(); 896 | this.container.removeClass("chosen-with-drop"); 897 | this.form_field_jq.trigger("chosen:hiding_dropdown", { 898 | chosen: this 899 | }); 900 | } 901 | return this.results_showing = false; 902 | }; 903 | 904 | Chosen.prototype.set_tab_index = function(el) { 905 | var ti; 906 | if (this.form_field.tabIndex) { 907 | ti = this.form_field.tabIndex; 908 | this.form_field.tabIndex = -1; 909 | return this.search_field[0].tabIndex = ti; 910 | } 911 | }; 912 | 913 | Chosen.prototype.set_label_behavior = function() { 914 | var _this = this; 915 | this.form_field_label = this.form_field_jq.parents("label"); 916 | if (!this.form_field_label.length && this.form_field.id.length) { 917 | this.form_field_label = $("label[for='" + this.form_field.id + "']"); 918 | } 919 | if (this.form_field_label.length > 0) { 920 | return this.form_field_label.bind('click.chosen', function(evt) { 921 | if (_this.is_multiple) { 922 | return _this.container_mousedown(evt); 923 | } else { 924 | return _this.activate_field(); 925 | } 926 | }); 927 | } 928 | }; 929 | 930 | Chosen.prototype.show_search_field_default = function() { 931 | if (this.is_multiple && this.choices_count() < 1 && !this.active_field) { 932 | this.search_field.val(this.default_text); 933 | return this.search_field.addClass("default"); 934 | } else { 935 | this.search_field.val(""); 936 | return this.search_field.removeClass("default"); 937 | } 938 | }; 939 | 940 | Chosen.prototype.search_results_mouseup = function(evt) { 941 | var target; 942 | target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); 943 | if (target.length) { 944 | this.result_highlight = target; 945 | this.result_select(evt); 946 | return this.search_field.focus(); 947 | } 948 | }; 949 | 950 | Chosen.prototype.search_results_mouseover = function(evt) { 951 | var target; 952 | target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); 953 | if (target) { 954 | return this.result_do_highlight(target); 955 | } 956 | }; 957 | 958 | Chosen.prototype.search_results_mouseout = function(evt) { 959 | if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) { 960 | return this.result_clear_highlight(); 961 | } 962 | }; 963 | 964 | Chosen.prototype.choice_build = function(item) { 965 | var choice, close_link, 966 | _this = this; 967 | choice = $('
    • ', { 968 | "class": "search-choice" 969 | }).html("" + (this.choice_label(item)) + ""); 970 | if (item.disabled) { 971 | choice.addClass('search-choice-disabled'); 972 | } else { 973 | close_link = $('', { 974 | "class": 'search-choice-close', 975 | 'data-option-array-index': item.array_index 976 | }); 977 | close_link.bind('click.chosen', function(evt) { 978 | return _this.choice_destroy_link_click(evt); 979 | }); 980 | choice.append(close_link); 981 | } 982 | return this.search_container.before(choice); 983 | }; 984 | 985 | Chosen.prototype.choice_destroy_link_click = function(evt) { 986 | evt.preventDefault(); 987 | evt.stopPropagation(); 988 | if (!this.is_disabled) { 989 | return this.choice_destroy($(evt.target)); 990 | } 991 | }; 992 | 993 | Chosen.prototype.choice_destroy = function(link) { 994 | if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) { 995 | this.show_search_field_default(); 996 | if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) { 997 | this.results_hide(); 998 | } 999 | link.parents('li').first().remove(); 1000 | return this.search_field_scale(); 1001 | } 1002 | }; 1003 | 1004 | Chosen.prototype.results_reset = function() { 1005 | this.reset_single_select_options(); 1006 | this.form_field.options[0].selected = true; 1007 | this.single_set_selected_text(); 1008 | this.show_search_field_default(); 1009 | this.results_reset_cleanup(); 1010 | this.form_field_jq.trigger("change"); 1011 | if (this.active_field) { 1012 | return this.results_hide(); 1013 | } 1014 | }; 1015 | 1016 | Chosen.prototype.results_reset_cleanup = function() { 1017 | this.current_selectedIndex = this.form_field.selectedIndex; 1018 | return this.selected_item.find("abbr").remove(); 1019 | }; 1020 | 1021 | Chosen.prototype.result_select = function(evt) { 1022 | var high, item; 1023 | if (this.result_highlight) { 1024 | high = this.result_highlight; 1025 | this.result_clear_highlight(); 1026 | if (this.is_multiple && this.max_selected_options <= this.choices_count()) { 1027 | this.form_field_jq.trigger("chosen:maxselected", { 1028 | chosen: this 1029 | }); 1030 | return false; 1031 | } 1032 | if (this.is_multiple) { 1033 | high.removeClass("active-result"); 1034 | } else { 1035 | this.reset_single_select_options(); 1036 | } 1037 | high.addClass("result-selected"); 1038 | item = this.results_data[high[0].getAttribute("data-option-array-index")]; 1039 | item.selected = true; 1040 | this.form_field.options[item.options_index].selected = true; 1041 | this.selected_option_count = null; 1042 | if (this.is_multiple) { 1043 | this.choice_build(item); 1044 | } else { 1045 | this.single_set_selected_text(this.choice_label(item)); 1046 | } 1047 | if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) { 1048 | this.results_hide(); 1049 | } 1050 | this.search_field.val(""); 1051 | if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) { 1052 | this.form_field_jq.trigger("change", { 1053 | 'selected': this.form_field.options[item.options_index].value 1054 | }); 1055 | } 1056 | this.current_selectedIndex = this.form_field.selectedIndex; 1057 | evt.preventDefault(); 1058 | return this.search_field_scale(); 1059 | } 1060 | }; 1061 | 1062 | Chosen.prototype.single_set_selected_text = function(text) { 1063 | if (text == null) { 1064 | text = this.default_text; 1065 | } 1066 | if (text === this.default_text) { 1067 | this.selected_item.addClass("chosen-default"); 1068 | } else { 1069 | this.single_deselect_control_build(); 1070 | this.selected_item.removeClass("chosen-default"); 1071 | } 1072 | return this.selected_item.find("span").html(text); 1073 | }; 1074 | 1075 | Chosen.prototype.result_deselect = function(pos) { 1076 | var result_data; 1077 | result_data = this.results_data[pos]; 1078 | if (!this.form_field.options[result_data.options_index].disabled) { 1079 | result_data.selected = false; 1080 | this.form_field.options[result_data.options_index].selected = false; 1081 | this.selected_option_count = null; 1082 | this.result_clear_highlight(); 1083 | if (this.results_showing) { 1084 | this.winnow_results(); 1085 | } 1086 | this.form_field_jq.trigger("change", { 1087 | deselected: this.form_field.options[result_data.options_index].value 1088 | }); 1089 | this.search_field_scale(); 1090 | return true; 1091 | } else { 1092 | return false; 1093 | } 1094 | }; 1095 | 1096 | Chosen.prototype.single_deselect_control_build = function() { 1097 | if (!this.allow_single_deselect) { 1098 | return; 1099 | } 1100 | if (!this.selected_item.find("abbr").length) { 1101 | this.selected_item.find("span").first().after(""); 1102 | } 1103 | return this.selected_item.addClass("chosen-single-with-deselect"); 1104 | }; 1105 | 1106 | Chosen.prototype.get_search_text = function() { 1107 | return $('
      ').text($.trim(this.search_field.val())).html(); 1108 | }; 1109 | 1110 | Chosen.prototype.winnow_results_set_highlight = function() { 1111 | var do_high, selected_results; 1112 | selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : []; 1113 | do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first(); 1114 | if (do_high != null) { 1115 | return this.result_do_highlight(do_high); 1116 | } 1117 | }; 1118 | 1119 | Chosen.prototype.no_results = function(terms) { 1120 | var no_results_html; 1121 | no_results_html = $('
    • ' + this.results_none_found + ' ""
    • '); 1122 | no_results_html.find("span").first().html(terms); 1123 | this.search_results.append(no_results_html); 1124 | return this.form_field_jq.trigger("chosen:no_results", { 1125 | chosen: this 1126 | }); 1127 | }; 1128 | 1129 | Chosen.prototype.no_results_clear = function() { 1130 | return this.search_results.find(".no-results").remove(); 1131 | }; 1132 | 1133 | Chosen.prototype.keydown_arrow = function() { 1134 | var next_sib; 1135 | if (this.results_showing && this.result_highlight) { 1136 | next_sib = this.result_highlight.nextAll("li.active-result").first(); 1137 | if (next_sib) { 1138 | return this.result_do_highlight(next_sib); 1139 | } 1140 | } else { 1141 | return this.results_show(); 1142 | } 1143 | }; 1144 | 1145 | Chosen.prototype.keyup_arrow = function() { 1146 | var prev_sibs; 1147 | if (!this.results_showing && !this.is_multiple) { 1148 | return this.results_show(); 1149 | } else if (this.result_highlight) { 1150 | prev_sibs = this.result_highlight.prevAll("li.active-result"); 1151 | if (prev_sibs.length) { 1152 | return this.result_do_highlight(prev_sibs.first()); 1153 | } else { 1154 | if (this.choices_count() > 0) { 1155 | this.results_hide(); 1156 | } 1157 | return this.result_clear_highlight(); 1158 | } 1159 | } 1160 | }; 1161 | 1162 | Chosen.prototype.keydown_backstroke = function() { 1163 | var next_available_destroy; 1164 | if (this.pending_backstroke) { 1165 | this.choice_destroy(this.pending_backstroke.find("a").first()); 1166 | return this.clear_backstroke(); 1167 | } else { 1168 | next_available_destroy = this.search_container.siblings("li.search-choice").last(); 1169 | if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) { 1170 | this.pending_backstroke = next_available_destroy; 1171 | if (this.single_backstroke_delete) { 1172 | return this.keydown_backstroke(); 1173 | } else { 1174 | return this.pending_backstroke.addClass("search-choice-focus"); 1175 | } 1176 | } 1177 | } 1178 | }; 1179 | 1180 | Chosen.prototype.clear_backstroke = function() { 1181 | if (this.pending_backstroke) { 1182 | this.pending_backstroke.removeClass("search-choice-focus"); 1183 | } 1184 | return this.pending_backstroke = null; 1185 | }; 1186 | 1187 | Chosen.prototype.keydown_checker = function(evt) { 1188 | var stroke, _ref1; 1189 | stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode; 1190 | this.search_field_scale(); 1191 | if (stroke !== 8 && this.pending_backstroke) { 1192 | this.clear_backstroke(); 1193 | } 1194 | switch (stroke) { 1195 | case 8: 1196 | this.backstroke_length = this.search_field.val().length; 1197 | break; 1198 | case 9: 1199 | if (this.results_showing && !this.is_multiple) { 1200 | this.result_select(evt); 1201 | } 1202 | this.mouse_on_container = false; 1203 | break; 1204 | case 13: 1205 | if (this.results_showing) { 1206 | evt.preventDefault(); 1207 | } 1208 | break; 1209 | case 32: 1210 | if (this.disable_search) { 1211 | evt.preventDefault(); 1212 | } 1213 | break; 1214 | case 38: 1215 | evt.preventDefault(); 1216 | this.keyup_arrow(); 1217 | break; 1218 | case 40: 1219 | evt.preventDefault(); 1220 | this.keydown_arrow(); 1221 | break; 1222 | } 1223 | }; 1224 | 1225 | Chosen.prototype.search_field_scale = function() { 1226 | var div, f_width, h, style, style_block, styles, w, _i, _len; 1227 | if (this.is_multiple) { 1228 | h = 0; 1229 | w = 0; 1230 | style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"; 1231 | styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing']; 1232 | for (_i = 0, _len = styles.length; _i < _len; _i++) { 1233 | style = styles[_i]; 1234 | style_block += style + ":" + this.search_field.css(style) + ";"; 1235 | } 1236 | div = $('
      ', { 1237 | 'style': style_block 1238 | }); 1239 | div.text(this.search_field.val()); 1240 | $('body').append(div); 1241 | w = div.width() + 25; 1242 | div.remove(); 1243 | f_width = this.container.outerWidth(); 1244 | if (w > f_width - 10) { 1245 | w = f_width - 10; 1246 | } 1247 | return this.search_field.css({ 1248 | 'width': w + 'px' 1249 | }); 1250 | } 1251 | }; 1252 | 1253 | return Chosen; 1254 | 1255 | })(AbstractChosen); 1256 | 1257 | }).call(this); 1258 | -------------------------------------------------------------------------------- /templates/dcload_ui/index.html: -------------------------------------------------------------------------------- 1 | {% load staticfiles %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
      18 |

      Status

      19 | 20 | 21 | 22 | 23 | 24 |
      Amps:
      Volts:
      Watts:
      Temp:
      25 |
      26 | 27 |
      28 |

      Desired Amps

      29 |
      30 |
      31 |
      32 |
      33 | 34 | 35 | 36 | 37 |
      38 |
      39 | 40 | 41 | 42 | 43 |
      44 |
      45 |
      46 | 47 | 48 |
      49 |
      50 | 51 |
      52 |

      Enable

      53 | 54 | 55 |
      56 | 57 | 58 | -------------------------------------------------------------------------------- /up.sh: -------------------------------------------------------------------------------- 1 | pushd ../smb-pi-lib 2 | rsync -avz --exclude "__history" --exclude "*~" --exclude "*.gif" --exclude "*.JPG" -e ssh . pi@198.0.0.25:/home/pi/smb-pi-lib 3 | popd 4 | rsync -avz --exclude "__history" --exclude "*~" --exclude "*.gif" --exclude "*.JPG" -e ssh . pi@198.0.0.25:/home/pi/dcload 5 | -------------------------------------------------------------------------------- /web_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | import dcload_control 5 | 6 | if __name__ == "__main__": 7 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dcload_django.settings") 8 | 9 | from django.core.management import execute_from_command_line 10 | 11 | dcload_control.startup() 12 | 13 | execute_from_command_line([sys.executable, "runserver", "0.0.0.0:80", "--noreload"]) 14 | --------------------------------------------------------------------------------