def add_treeview(self):
num_columns = [float for x in range(len(self.data.columns))]
liststore = Gtk.ListStore(*num_columns)
for ref in self.data.values.tolist():
liststore.append(ref)
treeview = Gtk.TreeView.new_with_model(liststore)
for i, column_title in enumerate(self.data.columns):
renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn(column_title, renderer, text=i)
treeview.append_column(column)
self.scrollable_treelist = Gtk.ScrolledWindow()
self.scrollable_treelist.add(treeview)
self.scrollable_treelist.set_vexpand(True)
self.scrollable_treelist.set_hexpand(True)
self.verticalbox.pack_start(self.scrollable_treelist, True, True, 0)
self.verticalbox.show_all()
python类CellRendererText()的实例源码
def __init__(self, window):
Gtk.ScrolledWindow.__init__(self)
# Parent window
self._window = window
# Tree view
self._tree_view = Gtk.TreeView(Gtk.ListStore(int, int, str, str))
self._tree_view.set_headers_visible(False)
renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Message", renderer, text=2, background=3)
self._tree_view.append_column(column)
self._tree_view.connect("row-activated", self.on_row_activated)
self.add(self._tree_view)
self.show_all()
def create_relocs_columns(self):
rendererPix = Gtk.CellRendererPixbuf()
rendererText = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Name")
column.set_spacing(5)
column.pack_start(rendererPix, False)
column.pack_start(rendererText, True)
column.set_attributes(rendererText, text=1)
column.set_attributes(rendererPix, pixbuf=0)
column.set_sort_column_id(0)
self.append_column(column)
rendererText = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Virtual Address", rendererText, text=2)
self.store.set_sort_column_id(2,Gtk.SortType.ASCENDING)
column.set_sort_column_id(2)
self.append_column(column)
rendererText = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Size", rendererText, text=3)
column.set_sort_column_id(3)
self.append_column(column)
def create_exports_columns(self):
rendererPix = Gtk.CellRendererPixbuf()
rendererText = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Offset")
column.set_spacing(5)
column.pack_start(rendererPix, False)
column.pack_start(rendererText, True)
column.set_attributes(rendererText, text=1)
column.set_attributes(rendererPix, pixbuf=0)
self.store.set_sort_column_id(1,Gtk.SortType.ASCENDING)
column.set_sort_column_id(1)
self.append_column(column)
rendererText = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Name", rendererText, text=2)
column.set_sort_column_id(2)
self.append_column(column)
rendererText = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Ordinal", rendererText, text=3)
column.set_sort_column_id(3)
self.append_column(column)
self.set_model(self.store)
def create_classes_tree(self):
self.treestore = Gtk.TreeStore(GdkPixbuf.Pixbuf, str, str)
renderer_pix = Gtk.CellRendererPixbuf()
renderer_text = Gtk.CellRendererText()
column = Gtk.TreeViewColumn()
column.set_title("Offset")
column.set_spacing(5)
column.pack_start(renderer_pix, True)
column.pack_start(renderer_text, False)
column.set_attributes(renderer_pix, pixbuf=0)
column.set_attributes(renderer_text, text=1)
self.append_column(column)
renderer_text = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Name", renderer_text, text=2)
column.set_sort_column_id(2)
self.append_column(column)
self.set_model(self.treestore)
self.expand_all()
def create_strings_columns(self):
rendererText = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Address", rendererText, text=0)
column.set_sort_column_id(0)
self.append_column(column)
rendererText = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Size", rendererText, text=1)
#self.store.set_sort_column_id(2,Gtk.SortType.ASCENDING)
column.set_sort_column_id(1)
self.append_column(column)
rendererText = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("String", rendererText, text=2)
column.set_sort_column_id(2)
self.append_column(column)
def __create_gui(self):
"""
Create and display the GUI components of the gramplet.
"""
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.model = Gtk.ListStore(object, str, int)
view = Gtk.TreeView(self.model)
renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn(_("Person"), renderer, text=1)
view.append_column(column)
renderer = Gtk.CellRendererText()
renderer.set_property('editable', True)
renderer.connect('edited', self.__cell_edited)
column = Gtk.TreeViewColumn(_("ID"), renderer, text=2)
view.append_column(column)
vbox.pack_start(view, expand=True, fill=True, padding=0)
return vbox
def __init__(self, choices, change_handler=None):
self.model = gtk.ListStore(GObject.TYPE_STRING)
self._values = []
for label, value in choices:
self.model.append((label,))
self._values.append(value)
renderer = gtk.CellRendererText()
self.control = gtk.ScrolledWindow()
self.control.show()
self._treeview = gtk.TreeView(self.model)
self._treeview.show()
self.control.add(self._treeview)
self.control.set_shadow_type(gtk.ShadowType.ETCHED_OUT)
self.control.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
# Sadly there seems to be no way to adjust the size of the ScrolledWindow to its content.
# The default size of the ScrolledWindow is too small (making it hard to select the model).
self.control.set_size_request(200, -1)
column = gtk.TreeViewColumn()
column.pack_start(renderer, expand=False)
column.set_attributes(renderer, text=0)
self._treeview.append_column(column)
self._treeview.set_headers_visible(False)
self._selection = self._treeview.get_selection()
self._selection.set_mode(gtk.SelectionMode.MULTIPLE)
self.connect("changed", change_handler, self._selection)
def create_window(self):
self.dialog = Gtk.Dialog(None, None, Gtk.DialogFlags.MODAL)
self.dialog.set_decorated(False)
#
scrolledwindow = Gtk.ScrolledWindow()
scrolledwindow.set_can_focus(False)
scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
scrolledwindow.set_shadow_type(Gtk.ShadowType.ETCHED_OUT)
self.dialog.vbox.pack_start(scrolledwindow, Gtk.AttachOptions.SHRINK, Gtk.AttachOptions.SHRINK,0)
#
self.store = Gtk.ListStore(str)
for value in self.values:
self.store.append([value])
self.tree = Gtk.TreeView(self.store)
self.tree.set_headers_visible(False)
self.tree.set_can_focus(False)
renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn(title=None,cell_renderer=renderer, text=0)
self.tree.append_column(column)
#
scrolledwindow.add(self.tree)
self.tree.connect('focus-out-event',self.on_focus_out)
self.dialog.connect('focus-out-event',self.on_focus_out)
self.tree.connect('cursor-changed',self.on_cursor_changed)
self.dialog.show_all()
def __init__(self):
Gtk.ScrolledWindow.__init__(self)
self.list = Gtk.ListStore(str, bool)
self.view = Gtk.TreeView(self.list)
self.view.set_hexpand(True)
text_renderer = Gtk.CellRendererText()
check_renderer = Gtk.CellRendererToggle()
name_column = Gtk.TreeViewColumn('Gtk color list', text_renderer, text=0)
check_column = Gtk.TreeViewColumn('', check_renderer, active=1)
self.view.append_column(check_column)
self.view.append_column(name_column)
self.view.connect('row-activated', self.row_activated)
self.add(self.view)
names = ['active_text_color', 'inactive_text_color',
'active_text_shadow_color', 'inactive_text_shadow_color',
'active_border_color', 'inactive_border_color',
'active_color_1', 'active_color_2', 'active_highlight_1',
'active_highlight_2', 'active_mid_1', 'active_mid_2',
'active_shadow_1', 'active_shadow_2', 'inactive_color_1',
'inactive_color_2', 'inactive_highlight_1',
'inactive_highlight_2', 'inactive_mid_1', 'inactive_mid_2',
'inactive_shadow_1', 'inactive_shadow_2']
for name in names:
self.list.append([name, False])
def __init__(self):
super(CellRendererFadeWindow, self).__init__(title="CellRendererFade Example")
self.set_default_size(200, 200)
self.liststore = Gtk.ListStore(str, str)
self.liststore.append(["New", Gtk.STOCK_NEW])
self.liststore.append(["Open", Gtk.STOCK_OPEN])
self.liststore.append(["Save", Gtk.STOCK_SAVE])
treeview = Gtk.TreeView(model=self.liststore)
renderer_text = Gtk.CellRendererText()
column_text = Gtk.TreeViewColumn("Text", renderer_text, text=0)
treeview.append_column(column_text)
renderer_pixbuf = CellRenderFade(param=0.001)
column_pixbuf = Gtk.TreeViewColumn("Image", renderer_pixbuf, stock_id=1)
treeview.append_column(column_pixbuf)
self.add(treeview)
def __init__(self, icons):
super(OneConfViews, self).__init__()
model = Gtk.ListStore(GdkPixbuf.Pixbuf, GObject.TYPE_STRING,
GObject.TYPE_STRING)
model.set_sort_column_id(self.COL_HOSTNAME, Gtk.SortType.ASCENDING)
model.set_sort_func(self.COL_HOSTNAME, self._sort_hosts)
self.set_model(model)
self.set_headers_visible(False)
self.col = Gtk.TreeViewColumn('hostname')
hosticon_renderer = Gtk.CellRendererPixbuf()
hostname_renderer = Gtk.CellRendererText()
self.col.pack_start(hosticon_renderer, False)
self.col.add_attribute(hosticon_renderer, 'pixbuf', self.COL_ICON)
self.col.pack_start(hostname_renderer, True)
self.col.add_attribute(hostname_renderer, 'text', self.COL_HOSTNAME)
self.append_column(self.col)
self.current_hostid = None
self.hostids = []
# TODO: load the dynamic one (if present), later
self.default_computer_icon = icons.load_icon("computer", 22, 0)
self.connect("cursor-changed", self.on_cursor_changed)
def __init__(self, icons):
super(OneConfViews, self).__init__()
model = Gtk.ListStore(GdkPixbuf.Pixbuf, GObject.TYPE_STRING,
GObject.TYPE_STRING)
model.set_sort_column_id(self.COL_HOSTNAME, Gtk.SortType.ASCENDING)
model.set_sort_func(self.COL_HOSTNAME, self._sort_hosts)
self.set_model(model)
self.set_headers_visible(False)
self.col = Gtk.TreeViewColumn('hostname')
hosticon_renderer = Gtk.CellRendererPixbuf()
hostname_renderer = Gtk.CellRendererText()
self.col.pack_start(hosticon_renderer, False)
self.col.add_attribute(hosticon_renderer, 'pixbuf', self.COL_ICON)
self.col.pack_start(hostname_renderer, True)
self.col.add_attribute(hostname_renderer, 'text', self.COL_HOSTNAME)
self.append_column(self.col)
self.current_hostid = None
self.hostids = []
# TODO: load the dynamic one (if present), later
self.default_computer_icon = icons.load_icon("computer", 22, 0)
self.connect("cursor-changed", self.on_cursor_changed)
def setup_download_queue(self):
""" Setup the download queue"""
renderer = Gtk.CellRendererText()
name = Gtk.TreeViewColumn("Name",renderer,text=0)
status = Gtk.TreeViewColumn("Status",renderer,text=0)
progress = Gtk.TreeViewColumn("Progress",renderer,text=0)
self.download_queue.append_column(name)
self.download_queue.append_column(status)
self.download_queue.append_column(progress)
def build_columns(self, treeview, **kwargs):
"""Build columns for Gtk treeview"""
for i, item in enumerate(self.data):
column = Gtk.TreeViewColumn(
item.get("title"),
item.get("render", Gtk.CellRendererText(ellipsize=Pango.EllipsizeMode.END)),
**{item.get("attr", "text"): i}
)
column.set_visible(item.get("visible", True))
for k, v in kwargs.items():
column.set_property(k, v)
treeview.append_column(column)
def __init__(self):
Gtk.Window.__init__(self, title='My Window Title')
self.connect('delete-event', Gtk.main_quit)
store = Gtk.ListStore(str, str, str, str)
self.populate_store(store)
self.treeview = Gtk.TreeView(model=store)
renderer = Gtk.CellRendererText()
column_catalog = Gtk.TreeViewColumn('Catalog Name', renderer, text=0)
column_catalog.set_sort_column_id(0)
self.treeview.append_column(column_catalog)
column_dbname = Gtk.TreeViewColumn('Database Name', renderer, text=1)
column_dbname.set_sort_column_id(1)
self.treeview.append_column(column_dbname)
column_charset = Gtk.TreeViewColumn('Character Set', renderer, text=2)
column_charset.set_sort_column_id(2)
self.treeview.append_column(column_charset)
column_collation = Gtk.TreeViewColumn('Collation', renderer, text=3)
column_collation.set_sort_column_id(3)
self.treeview.append_column(column_collation)
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.set_policy(
Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
scrolled_window.add(self.treeview)
scrolled_window.set_min_content_height(200)
self.add(scrolled_window)
self.show_all()
# Add data to ListStore
def get_combobox(self):
"""
@description: get the combobox of the toolbar
@return: a Gtk.Combobox
"""
# the data in the model, of type string
listmodel = Gtk.ListStore(str)
# append the data in the model
listmodel.append(['All'])
listmodel.append(['External'])
listmodel.append(['Internal'])
listmodel.append(['Modules'])
# a combobox to see the data stored in the model
combobox = Gtk.ComboBox(model=listmodel)
combobox.set_tooltip_text("What type of command to add?")
# a cellrenderer to render the text
cell = Gtk.CellRendererText()
# pack the cell into the beginning of the combobox, allocating
# no more space than needed
combobox.pack_start(cell, False)
# associate a property ("text") of the cellrenderer (cell) to a column (column 0)
# in the model used by the combobox
combobox.add_attribute(cell, "text", 0)
# the first row is the active one by default at the beginning
combobox.set_active(0)
# connect the signal emitted when a row is selected to the callback function
combobox.connect("changed", self.on_combochanged)
return combobox
# callback function attach to the combobox
def __get_combobox(self, store, iter):
"""
@description: get the combobox of the toolbar
@return: a Gtk.Combobox
"""
# the data in the model, of type string
listmodel = Gtk.ListStore(str)
# append the data in the model
self.dic = {}
self.dic[0] = 'time'
listmodel.append(['time'])
self.dic[1] = 'power'
listmodel.append(['power'])
self.dic[2] = 'clipboard'
listmodel.append(['clipboard'])
selected = 0
if iter is not None:
for i in range(len(self.dic)):
if self.dic[i] == store[iter][1]:
selected = i
# a combobox to see the data stored in the model
combobox = Gtk.ComboBox(model=listmodel)
combobox.set_tooltip_text("Which internal command to choose" + '?')
# a cellrenderer to render the text
cell = Gtk.CellRendererText()
# pack the cell into the beginning of the combobox, allocating
# no more space than needed
combobox.pack_start(cell, False)
# associate a property ("text") of the cellrenderer (cell) to a column (column 0)
# in the model used by the combobox
combobox.add_attribute(cell, "text", 0)
# the first row is the active one by default at the beginning
combobox.set_active(selected)
return combobox
def __get_combobox(self):
"""
@description: get the combobox of the toolbar
@return: a Gtk.Combobox
"""
# the data in the model, of type string
listmodel = Gtk.ListStore(str)
# append the data in the model
selected = 4
i = 0
self.language_list = ['en-AU', 'en-CA', 'en-GB', 'en-IN', 'en-US']
for language_name in self.language_list:
listmodel.append([language_name])
if language_name == self.locale:
selected = i
i += 1
# a combobox to see the data stored in the model
combobox = Gtk.ComboBox(model=listmodel)
combobox.set_tooltip_text("What format to choose?")
# a cellrenderer to render the text
cell = Gtk.CellRendererText()
# pack the cell into the beginning of the combobox, allocating
# no more space than needed
combobox.pack_start(cell, False)
# associate a property ("text") of the cellrenderer (cell) to a column (column 0)
# in the model used by the combobox
combobox.add_attribute(cell, "text", 0)
# the first row is the active one by default at the beginning
combobox.set_active(selected)
# connect the signal emitted when a row is selected to the callback function
combobox.connect("changed", self.on_combochanged)
return combobox
def __get_rate_combobox(self):
"""
@description: get the sample rate combobox of the toolbar
@return: a Gtk.Combobox
"""
# the data in the model, of type string
listmodel = Gtk.ListStore(int)
# append the data in the model
selected = 0
i = 0
self.rate_list = [8000, 16000]
for rate_name in self.rate_list:
listmodel.append([rate_name])
if rate_name == self.audio_rate:
selected = i
i += 1
# a combobox to see the data stored in the model
rate_combobox = Gtk.ComboBox(model=listmodel)
rate_combobox.set_tooltip_text("Set Sampling Rate")
# a cellrenderer to render the text
rate_cell = Gtk.CellRendererText()
# pack the cell into the beginning of the combobox, allocating
# no more space than needed
rate_combobox.pack_start(rate_cell, False)
# associate a property ("text") of the cellrenderer (cell) to a column (column 0)
# in the model used by the combobox
rate_combobox.add_attribute(rate_cell, "text", 0)
# the first row is the active one by default at the beginning
rate_combobox.set_active(selected)
# connect the signal emitted when a row is selected to the callback function
rate_combobox.connect("changed", self.on_rate_combochanged)
return rate_combobox
def __get_speaker_combobox(self):
"""
@description: get the speaker combobox of the toolbar
@return: a Gtk.Combobox
"""
# the data in the model, of type string
listmodel = Gtk.ListStore(str)
# append the data in the model
selected = 0
i = 0
self.speaker_list = ['Mama (Male)', 'His Wife (Female)']
for speaker_name in self.speaker_list:
listmodel.append([speaker_name])
if speaker_name == self.speaker:
selected = i
i += 1
# a combobox to see the data stored in the model
speaker_combobox = Gtk.ComboBox(model=listmodel)
speaker_combobox.set_tooltip_text("Whose speaker to choose?")
# a cellrenderer to render the text
speaker_cell = Gtk.CellRendererText()
# pack the cell into the beginning of the combobox, allocating
# no more space than needed
speaker_combobox.pack_start(speaker_cell, False)
# associate a property ("text") of the cellrenderer (cell) to a column (column 0)
# in the model used by the combobox
speaker_combobox.add_attribute(speaker_cell, "text", 0)
# the first row is the active one by default at the beginning
speaker_combobox.set_active(selected)
# connect the signal emitted when a row is selected to the callback function
speaker_combobox.connect("changed", self.on_speaker_combochanged)
return speaker_combobox
def setup_widgets(self):
# Create
self._icon = Gtk.Image()
self._model = Gtk.ListStore(str, object, str)
self._combo = Gtk.ComboBox.new_with_model(self._model)
self._box = Gtk.Box(Gtk.Orientation.HORIZONTAL, 0)
self._savebutton = None
self._switch_to_button = None
# Setup
rend1 = Gtk.CellRendererText()
rend2 = Gtk.CellRendererText()
self._icon.set_margin_right(10)
self._combo.pack_start(rend1, True)
self._combo.pack_start(rend2, False)
self._combo.add_attribute(rend1, "text", 0)
self._combo.add_attribute(rend2, "text", 2)
self._combo.set_row_separator_func(
lambda model, iter : model.get_value(iter, 1) is None and model.get_value(iter, 0) == "-" )
self.update_icon()
# Signals
self._combo.connect('changed', self.on_combo_changed)
self.connect("button_press_event", self.on_button_press)
# Pack
self._box.pack_start(self._icon, False, True, 0)
self._box.pack_start(self._combo, True, True, 0)
self.add(self._box)
def __init__(self):
glade_dir = gv.jcchess.get_glade_dir()
self.glade_file = os.path.join(glade_dir, "gamelist.glade")
# create gamelist window
self.builder = Gtk.Builder()
self.builder.set_translation_domain(gv.domain)
self.builder.add_from_file(self.glade_file)
self.builder.connect_signals(self)
self.window = self.builder.get_object("gamelist_window")
self.treeview = self.builder.get_object("gamelist_treeview")
self.liststore = self.builder.get_object("liststore1")
cell0 = Gtk.CellRendererText()
# cell0.set_property("cell-background", Gdk.color_parse("#F8F8FF"))
tvcolumn0 = Gtk.TreeViewColumn()
self.treeview.append_column(tvcolumn0)
tvcolumn0.pack_start(cell0, True)
tvcolumn0.set_min_width(50)
tvcolumn0.set_attributes(cell0, text=0)
self.treeview.connect("row_activated", self.entry_clicked)
self.tree_selection = self.treeview.get_selection()
self.window.hide()
# user has closed the window
# just hide it
def __init__(self):
from playlist_creator import preferences_file_location, systems_list
self.settings_file_location = preferences_file_location
with open(self.settings_file_location) as data_file:
self.preferences_data = json.load(data_file)
builder = Gtk.Builder()
builder.add_from_file("glade/app.glade")
builder.connect_signals(self)
self.notebook = builder.get_object("notebook")
self.renderer_text = Gtk.CellRendererText()
self.playlists_directory_chooser = builder.get_object("playlists_directory_chooser")
self.cores_directory_chooser = builder.get_object("cores_directory_chooser")
self.infos_directory_chooser = builder.get_object("infos_directory_chooser")
self.playlists_location = self.preferences_data[0]['playlists_location']
self.cores_location = self.preferences_data[0]['cores_location']
self.infos_location = self.preferences_data[0]['infos_location']
self.playlists_directory_chooser.set_current_folder(self.playlists_location)
self.cores_directory_chooser.set_current_folder(self.cores_location)
self.infos_directory_chooser.set_current_folder(self.infos_location)
self.system_names = Gtk.ListStore(str)
for system_name in systems_list:
self.system_names.append([system_name])
# get all cores and populate list
self.__populate_cores_list__()
if len(self.preferences_data) > 1:
for system_from_prefs in self.preferences_data[1]:
self.create_new_tab(system_from_prefs['system_name'], system_from_prefs['roms_dir'],
system_from_prefs['core_path'], system_from_prefs['core_name'])
window = builder.get_object("window")
window.show_all()
Gtk.main()
SBrickConfigureDialog.py 文件源码
项目:sbrick-controller
作者: wintersandroid
项目源码
文件源码
阅读 29
收藏 0
点赞 0
评论 0
def create_channel_box(self, channel_number):
hbox = Gtk.FlowBox()
hbox.set_max_children_per_line(8)
hbox.set_min_children_per_line(8)
hbox.set_selection_mode(Gtk.SelectionMode.NONE)
hbox.add(Gtk.Label("Channel: %d" % channel_number))
hbox.add(Gtk.Label("ID:"))
id_edit = Gtk.Entry()
id_edit.set_max_length(5)
hbox.add(id_edit)
hbox.add(Gtk.Label("Name:"))
name_edit = Gtk.Entry()
name_edit.set_max_length(20)
hbox.add(name_edit)
hbox.add(Gtk.Label("Type:"))
combo_type = Gtk.ComboBoxText()
combo_type.set_id_column(0)
combo_type.set_model(self.channelTypeStore)
renderer_text = Gtk.CellRendererText()
combo_type.clear()
combo_type.pack_start(renderer_text, True)
combo_type.add_attribute(renderer_text, "text", 1)
hbox.add(combo_type)
self.content.pack_start(hbox, False, True, 0)
return id_edit, name_edit, combo_type
def __init__(self):
Gtk.Frame.__init__(self)
self.sbrick = None
self.set_label("SBrick Information")
self.store = Gtk.ListStore(str, str)
self.iterSBrickID = self.store.append(["SBrick BlueGiga ID", "--"])
self.iterHardwareVersion = self.store.append(["Hardware Version", "--"])
self.iterSoftwareVersion = self.store.append(["Software Version", "--"])
self.iterNeedAuthentication = self.store.append(["Need Authentication", "--"])
self.iterIsAuthenticated = self.store.append(["Is Authenticated", "--"])
self.iterAuthenticationTimeout = self.store.append(["Authentication Timeout", "--"])
self.iterInputVoltage = self.store.append(["Input Voltage", "--"])
self.iterTemperature = self.store.append(["Temperature", "--"])
self.iterPowerCycles = self.store.append(["Power Cycles", "--"])
self.iterWatchdogTimeout = self.store.append(["Watchdog Timeout", "--"])
self.iterUpTime = self.store.append(["Up Time", "--"])
self.iterThermalLimit = self.store.append(["Thermal Limit", "--"])
self.listView = Gtk.TreeView(self.store)
renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Item", renderer, text=0)
self.listView.append_column(column)
renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Value", renderer, text=1)
self.listView.append_column(column)
self.scrollTree = Gtk.ScrolledWindow()
self.scrollTree.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
self.scrollTree.add_with_viewport(self.listView)
self.scrollTree.set_min_content_height(100)
self.add(self.scrollTree)
self.set_sensitive(False)
def _create_market_combo(self):
store = Gtk.ListStore(str, str, str)
for market_config in config['markets']:
provider = btcwidget.exchanges.factory.get(market_config['exchange'])
market_name = '{} - {}'.format(provider.get_name(), market_config['market'])
store.append([market_name, market_config['exchange'], market_config['market']])
combo = Gtk.ComboBox.new_with_model(store)
renderer_text = Gtk.CellRendererText()
combo.pack_start(renderer_text, True)
combo.add_attribute(renderer_text, "text", 0)
return combo, store
def __init__(self, model, dep_type, label):
Gtk.TreeView.__init__(self)
self.current = None
self.dep_type = dep_type
self.filter_model = model.filter_new()
self.filter_model.set_visible_func(self._filter, data=None)
self.set_model(self.filter_model)
self.append_column(Gtk.TreeViewColumn(label, Gtk.CellRendererText(), text=COL_DEP_PACKAGE))
def __init__(self, model, label):
Gtk.TreeView.__init__(self)
self.current = None
self.filter_model = model.filter_new()
self.filter_model.set_visible_func(self._filter)
self.set_model(self.filter_model)
self.append_column(Gtk.TreeViewColumn(label, Gtk.CellRendererText(), text=COL_DEP_PARENT))
def __init__(self, builder):
GObject.GObject.__init__(self)
self._services = Gtk.ListStore(str, str, int)
self._profile = None
# Widgets
self._panel = builder.get_object('server-panel')
self._toolbar = builder.get_object('server-toolbar')
# Zeroconf
self._zeroconf_list = builder.get_object('server-zeroconf-list')
self._zeroconf_list.set_model(self._services)
renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Zeroconf", renderer, text=0)
self._zeroconf_list.append_column(column)
# Host
self._host_entry = builder.get_object('server-host')
# Port
self._port_spinner = builder.get_object('server-port')
# Passwort
self._password_entry = builder.get_object('server-password')
# Image directory
self._image_dir_entry = builder.get_object('server-image-dir')
# Zeroconf provider
self._zeroconf_provider = ZeroconfProvider()
self._zeroconf_provider.connect_signal(ZeroconfProvider.SIGNAL_SERVICE_NEW, self.on_new_service)