2014-12-30 18:40:19 +08:00
|
|
|
import os
|
|
|
|
|
|
|
|
from gi.repository import Gtk
|
|
|
|
|
|
|
|
|
|
|
|
data_dir = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
2015-01-02 15:28:45 +08:00
|
|
|
|
2014-12-30 18:40:19 +08:00
|
|
|
class Window(Gtk.Window):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
Gtk.Window.__init__(self, *args, **kwargs)
|
2014-12-30 19:19:26 +08:00
|
|
|
self.set_wmclass("ARTIQ", "ARTIQ")
|
2014-12-30 18:40:19 +08:00
|
|
|
self.set_icon_from_file(os.path.join(data_dir, "icon.png"))
|
|
|
|
self.set_border_width(6)
|
2015-01-02 15:28:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
class ListSyncer:
|
|
|
|
def __init__(self, store, init):
|
|
|
|
self.store = store
|
|
|
|
self.store.clear()
|
|
|
|
for x in init:
|
|
|
|
self.append(x)
|
|
|
|
|
|
|
|
def append(self, x):
|
|
|
|
self.store.append(self.convert(x))
|
|
|
|
|
|
|
|
def insert(self, i, x):
|
|
|
|
self.store.insert(i, self.convert(x))
|
|
|
|
|
|
|
|
def __delitem__(self, key):
|
|
|
|
del self.store[key]
|