comparison bin/keyboardcomposer @ 946:7e991dba05f4

KC supports dragging into (existing) named groups. still can't make a new group though Ignore-this: 5a841c6e8b5dbf6b99da9afbec88b9fd
author drewp@bigasterisk.com
date Thu, 13 Jun 2013 07:22:54 +0000
parents 85ccda959170
children f7ffd7aeb7f0
comparison
equal deleted inserted replaced
945:85ccda959170 946:7e991dba05f4
17 from light9.Submaster import Submasters, sub_maxes 17 from light9.Submaster import Submasters, sub_maxes
18 from light9.subclient import SubClient 18 from light9.subclient import SubClient
19 from light9 import dmxclient, showconfig, networking, prof 19 from light9 import dmxclient, showconfig, networking, prof
20 from light9.uihelpers import toplevelat, bindkeys 20 from light9.uihelpers import toplevelat, bindkeys
21 from light9.namespaces import L9 21 from light9.namespaces import L9
22 from light9.tkdnd import initTkdnd, dragSourceRegister 22 from light9.tkdnd import initTkdnd, dragSourceRegister, dropTargetRegister
23 from light9.rdfdb import clientsession 23 from light9.rdfdb import clientsession
24 from light9.rdfdb.syncedgraph import SyncedGraph 24 from light9.rdfdb.syncedgraph import SyncedGraph
25 from light9.rdfdb.patch import Patch 25 from light9.rdfdb.patch import Patch
26 26
27 from bcf2000 import BCF2000 27 from bcf2000 import BCF2000
233 233
234 for group, order, sub in withgroups: 234 for group, order, sub in withgroups:
235 group = self.graph.value(sub.uri, L9['group']) 235 group = self.graph.value(sub.uri, L9['group'])
236 236
237 if col == 0 or group != last_group: 237 if col == 0 or group != last_group:
238 row = self.make_row() 238 row = self.make_row(group)
239 rowcount += 1 239 rowcount += 1
240 col = 0 240 col = 0
241 241
242 subbox = SubmasterBox(row, sub, self.session) 242 subbox = SubmasterBox(row, sub, self.session)
243 subbox.place(relx=col / 8, rely=0, relwidth=1 / 8, relheight=1) 243 subbox.place(relx=col / 8, rely=0, relwidth=1 / 8, relheight=1)
392 # we won't really see it 392 # we won't really see it
393 if abs(v - self.sliders.lastValue.get(chan, -5)) <= 1: 393 if abs(v - self.sliders.lastValue.get(chan, -5)) <= 1:
394 return 394 return
395 self.sliders.valueOut(chan, v) 395 self.sliders.valueOut(chan, v)
396 396
397 def make_row(self): 397 def make_row(self, group):
398 """group is a URI or None"""
398 row = Frame(self, bd=2, bg='black') 399 row = Frame(self, bd=2, bg='black')
400 row.subGroup = group
401 def onDrop(ev):
402 self.change_group(sub=URIRef(ev.data), row=row)
403 return "link"
404
405 dropTargetRegister(row, onDrop=onDrop, typeList=['*'],
406 hoverStyle=dict(background="#555500"))
407
399 row.pack(expand=1, fill=BOTH) 408 row.pack(expand=1, fill=BOTH)
400 self.setup_key_nudgers(row) 409 self.setup_key_nudgers(row)
401 self.rows.append(row) 410 self.rows.append(row)
402 return row 411 return row
403 412
413 def change_group(self, sub, row):
414 """update this sub's group, and maybe other sub groups as needed, so
415 this sub displays in this row"""
416 group = row.subGroup
417 self.graph.patchObject(
418 context=self.session,
419 subject=sub, predicate=L9['group'], newObject=group)
420
421 def subs_in_row(self, row):
422 """uris of the submasters displayed in this row. untested"""
423 rowNum = self.rows.index(row) + 1
424 ret = set()
425 for coords, subbox in self.slider_table.items():
426 if coords[0] == rowNum:
427 ret.add(subbox.sub.uri)
428 return ret
429
404 def highlight_row(self, row): 430 def highlight_row(self, row):
405 row = self.rows[row] 431 row = self.rows[row]
406 row['bg'] = 'red' 432 row['bg'] = 'red'
407 433
408 def unhighlight_row(self, row): 434 def unhighlight_row(self, row):