def _create_select_inputwidget_gui(self):
"""
This will be called by HarmonicInterval and MelodicInterval
constructor
"""
hbox = gu.bHBox(self.config_box, False)
hbox.set_spacing(gu.PAD_SMALL)
gu.bLabel(hbox, _("Input interface:"), False)
combo = Gtk.ComboBoxText()
for i in range(len(inputwidgets.inputwidget_names)):
combo.append_text(inputwidgets.inputwidget_names[i])
if self.get_int('inputwidget') < len(inputwidgets.inputwidget_names):
combo.set_active(self.get_int('inputwidget'))
else:
combo.set_active(0)
combo.connect('changed', lambda w: self.use_inputwidget(w.get_active()))
hbox.pack_start(combo, False, False, 0)
self.g_disable_unused_buttons = gu.nCheckButton(self.m_exname,
'disable_unused_intervals', _("_Disable unused buttons"))
hbox.pack_start(self.g_disable_unused_buttons, True, True, 0)
python类ComboBoxText()的实例源码
def __init__(self, tviews, uicore):
super(RightCombo,self).__init__(1, 7, False)
self.tviews = tviews
self.uicore = uicore
# Theme Label
self.theme_label = Gtk.Label(label='Color theme:')
self.attach(self.theme_label, 0, 1, 0, 1)
# Theme ComboBox
self.theme_combo = Gtk.ComboBoxText()
options = ['Classic', 'Cobalt', 'kate', 'Oblivion', 'Tango']
for option in options:
self.theme_combo.append_text(option)
# Set first by default
self.theme_combo.set_active(0)
self.theme_combo.connect("changed", self.theme_combo_change)
self.attach(self.theme_combo, 1, 2, 0, 1)
def __init__(self):
self.main_window = Gtk.Window()
self.main_window.set_border_width(5)
self.main_window.connect("destroy", self._destroy)
self.main_vbox = Gtk.VBox()
self.select_hbox = Gtk.HBox()
self.select_button = Gtk.Button("Select")
self.select_button.connect("clicked", self._select_clicked)
self.select_hbox.pack_start(self.select_button, False, True, 0)
self.file_combo = Gtk.ComboBoxText()
self.file_combo.connect("changed", self._file_combo_changed)
self.select_hbox.pack_start(self.file_combo, True, True, 0)
self.main_vbox.pack_start(self.select_hbox, False, True, 0)
self.metadata_table = Gtk.Table(1, 1)
self.metadata_table.attach(
Gtk.Label("Select a file to view metadata information..."), 0, 1, 0, 1)
self.main_vbox.pack_start(self.metadata_table, True, True, 0)
self.main_window.add(self.main_vbox)
self.main_window.show_all()
SBrickConfigureDialog.py 文件源码
项目:sbrick-controller
作者: wintersandroid
项目源码
文件源码
阅读 20
收藏 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 create_combo(self, n):
command_combo = Gtk.ComboBoxText()
command_combo.set_entry_text_column(0)
command_combo.set_size_request(200, 20)
for cmd in defaults:
command_combo.append_text(cmd[0])
return command_combo
def __populate_preferences(self):
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
hbox_theme = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=50)
themes = ["Day (light)", "Night (dark)"]
self.themes_combo = Gtk.ComboBoxText()
self.themes_combo.set_entry_text_column(0)
self.themes_combo.connect("changed", self.__on_themes_combo_changed)
for theme in themes:
self.themes_combo.append_text(theme)
if self.window.config_provider.config["Application"]["stylesheet"] == "Day":
self.themes_combo.set_active(0)
else:
self.themes_combo.set_active(1)
hbox_theme.pack_end(self.themes_combo, False, True, 0)
theme_label = Gtk.Label(_("Application theme") ,xalign=0)
hbox_theme.pack_start(theme_label, False, True, 0)
vbox.pack_start(hbox_theme, False, True, 0)
try:
vbox.set_margin_start(20)
vbox.set_margin_end(20)
except AttributeError:
print("Gtk-WARNING **: GTK+ ver. below 3.12 will cause application interface to misbehave")
vbox.set_margin_left(20)
vbox.set_margin_right(20)
vbox.set_margin_top(20)
self.add(vbox)
def nComboBox(exname, name, default, popdown_strings):
c = Gtk.ComboBoxText()
for n in popdown_strings:
c.append_text(n)
c.m_exname = exname
c.m_name = name
val = cfg.get_string("%s/%s=X" % (c.m_exname, c.m_name))
if val == 'X':
cfg.set_int("%s/%s" % (exname, name),
popdown_strings.index(default))
c.set_active(popdown_strings.index(default))
else:
try:
i = cfg.get_int("%s/%s" % (c.m_exname, c.m_name))
except ValueError:
i = 0
cfg.set_int("%s/%s" % (c.m_exname, c.m_name), 0)
if i >= len(popdown_strings):
i = 0
cfg.set_int("%s/%s" % (c.m_exname, c.m_name), 0)
c.set_active(cfg.get_int("%s/%s" % (c.m_exname, c.m_name)))
def f(combobox):
cfg.set_int("%s/%s" % (exname, name), combobox.get_active())
c.connect('changed', f)
return c
def generate_ge_selector(self):
ge_type_selector = Gtk.ComboBoxText()
ge_type_selector.append_text('None')
ge_numbers = {'A':3, 'B':6, 'C':5, 'D':3}
ge_numbers = OrderedDict(sorted(ge_numbers.items(), key=lambda t: t[0]))
for ge_type, how_many in ge_numbers.items():
for x in range(how_many):
ge_type_selector.append_text('{}{}'.format(ge_type,x+1))
ge_type_selector.append_text('D4/E')
ge_type_selector.append_text('D5')
ge_type_selector.append_text('F')
return ge_type_selector
def create_import_from_server_dialog(self, chart_list):
import_chart = None
import_dialog = Gtk.Dialog("Import from server", self, 0)
box = import_dialog.get_content_area()
content_box = Gtk.Box()
box.add(content_box)
chart_selector = Gtk.ComboBoxText()
for chart in sorted(chart_list):
chart_selector.append_text(chart)
content_box.pack_start(Gtk.Label("Choose a chart:"), True, True, 0)
content_box.pack_start(chart_selector, True, True, 0)
import_dialog.add_button('Import', Gtk.ResponseType.OK)
content_box.show_all()
response = import_dialog.run()
if response == Gtk.ResponseType.OK:
import_chart = chart_selector.get_active_text()
import_dialog.destroy()
if import_chart:
return import_chart
def add_combo(self, text, key, entries_list, type_):
def on_changed(combo):
value = combo.props.active_id
if value is None: return
self._settings[key] = type_(value)
item = Gtk.ComboBoxText()
for entry in entries_list:
item.insert(-1, entry['value'], entry['title'].strip())
item.set_active_id(self._settings[key])
item.connect('changed', on_changed)
return self.add_row(text, item)
def setting_element(option, title, value, tp, desc, list):
grid = Gtk.Grid()
label = Gtk.Label()
label.set_alignment(0.0, 0.5)
label.set_property("margin-bottom", 10)
if desc: label.set_markup(\
"{}\n<span size='small'>{}</span>".format(_(title), _(desc)))
else: label.set_markup(_(title))
if tp == "1":
elem = Gtk.Entry(name=option)
elem.set_width_chars(30)
elem.set_text(value)
if tp == "2":
elem = Gtk.ComboBoxText(name=option)
elem.set_entry_text_column(0)
for i in list: elem.append_text(i)
elem.set_active(int(value))
grid.attach(label, 0, 0, 1, 1)
grid.attach(elem, 0, 1, 1, 1)
grid.set_property("margin", 10)
return grid
def on_save_settings(self, opts):
with settings_con:
cur = settings_con.cursor()
for i in opts:
if type(i) == Gtk.Entry: value = i.get_text()
if type(i) == Gtk.ComboBoxText: value = i.get_active()
cur.execute("UPDATE settings SET value=? WHERE option=?;",(value, i.get_name(),))
decision = dialog().decision(_("Are you sure?"), "<span size='small'>{}.</span>"\
.format(_("Clicking on OK, all edited settings will be saved and browser will restart")))
if decision: self.restart()
def __init__(self, express, selector, location_box):
Gtk.ComboBoxText.__init__(self)
self.connect("changed", self.country_change)
self.express = express
self.selector = selector
self.location_box = location_box
self.update()
def __init__(self, express, selector):
Gtk.ComboBoxText.__init__(self)
self.connect("changed", self.location_change)
self.express = express
self.selector = selector
def _build_format_section(self, radio_button_label, format_labels,
callback_radio=None, callback_combo=None,
radio_group=None):
"""
"""
radio_button = Gtk.RadioButton(
radio_button_label, group=radio_group)
if callback_radio:
radio_button.connect("toggled", callback_radio)
text_label = Gtk.Label("Format : ")
combo_box = Gtk.ComboBoxText()
for label in format_labels:
combo_box.append_text(label)
combo_box.set_active(0)
# This version accept only one format for each stream type.
# There is not point to allow user to use this combo box.
# That way the format is displayed as information.
combo_box.set_sensitive(False)
if callback_combo:
combo_box.connect("changed", callback_combo)
hbox = Gtk.Box(Gtk.Orientation.HORIZONTAL)
hbox.set_margin_left(24)
_pack_widgets(hbox, text_label, combo_box)
return (radio_button, hbox, combo_box)
def set_active_text(self, comboboxtext_widget, text_list, text):
"""
Set active text of ``comboboxtext_widget`` to ``text`` if ``text`` is
in ``text_list``.
:param comboboxtext_widget: :class:`Gtk.ComboBoxText`
:param text_list: list of string appened to ``comboboxtext_widget``
:param text: string to set active as :class:`str`
"""
for index, text_element in enumerate(text_list):
if text == text_element:
comboboxtext_widget.set_active(index)
break
def __init__(self, step_configuration, functions):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
self.set_homogeneous(False)
self.step_configuration = step_configuration
self.functions = functions
self.sbrick = None
self.show_all()
self.function_group_model = Gtk.ListStore(str, str)
self.function_model = Gtk.ListStore(str, str)
# function group
self.pack_start(Gtk.Label("Function Group:"), False, True, 0)
self.combo_function_group = Gtk.ComboBoxText()
self.combo_function_group.set_id_column(0)
self.combo_function_group.set_model(self.function_group_model)
renderer_text = Gtk.CellRendererText()
self.combo_function_group.clear()
self.combo_function_group.pack_start(renderer_text, True)
self.combo_function_group.add_attribute(renderer_text, "text", 1)
self.pack_start(self.combo_function_group, False, True, 0)
self.combo_function_group.connect("changed", self.on_group_changed)
# function group
self.add(Gtk.Label("Function:"))
self.combo_function = Gtk.ComboBoxText()
self.combo_function.set_id_column(0)
self.combo_function.set_model(self.function_model)
renderer_text = Gtk.CellRendererText()
self.combo_function.clear()
self.combo_function.pack_start(renderer_text, True)
self.combo_function.add_attribute(renderer_text, "text", 1)
self.pack_start(self.combo_function, False, True, 0)
self.pack_start(Gtk.Label("MS Delay After:"), False, True, 0)
self.timeAdjustment = Gtk.Adjustment(1000, -1, 120000, 10, 100, 0.0)
self.spinDelayAfter = Gtk.SpinButton.new(self.timeAdjustment, 10, 0)
self.pack_start(self.spinDelayAfter, False, True, 0)
self.update_group_model()
if "function_group" in self.step_configuration:
self.combo_function_group.set_active_id(self.step_configuration["function_group"])
self.update_function_model(self.combo_function_group.get_active_id())
if "function" in self.step_configuration:
self.combo_function.set_active_id(self.step_configuration["function"])
if "delay_time" in self.step_configuration:
self.timeAdjustment.set_value(int(step_configuration["delay_time"]))
def create_win32_sound_page(self):
it, page_vbox = self.new_page_box(None, _("Sound Setup"))
#############
# midi setup
#############
txt = Gtk.Label(_("""Solfege has two ways to play MIDI files. It is recommended to use Windows multimedia output. An external MIDI player can be useful if your soundcard lacks a hardware synth, in which case you have to use a program like timidity to play the music."""))
txt.set_line_wrap(1)
txt.set_justify(Gtk.Justification.FILL)
txt.set_alignment(0.0, 0.0)
page_vbox.pack_start(txt, False, False, 0)
self.g_fakesynth_radio = gu.RadioButton(None, _("_No sound"), None)
page_vbox.pack_start(self.g_fakesynth_radio, False, False, 0)
hbox = gu.bHBox(page_vbox, False)
self.g_device_radio = gu.RadioButton(self.g_fakesynth_radio,
_("_Windows multimedia output:"), None)
self.g_synth = Gtk.ComboBoxText()
if winmidi:
for devname in winmidi.output_devices():
#FIXME workaround of the bug
# http://code.google.com/p/solfege/issues/detail?id=12
if devname is None:
self.g_synth.append_text("FIXME bug #12")
else:
self.g_synth.append_text(devname)
self.g_synth.set_active(self.get_int('sound/synth_number') + 1)
hbox.pack_start(self.g_device_radio, False, False, 0)
hbox.pack_start(self.g_synth, False, False, 0)
hbox = gu.bHBox(page_vbox, False)
self.g_midiplayer_radio = gu.RadioButton(self.g_fakesynth_radio,
_("Use _external MIDI player"), None)
hbox.pack_start(self.g_midiplayer_radio, False, False, 0)
if self.get_string("sound/type") == "external-midiplayer":
self.g_midiplayer_radio.set_active(True)
elif self.get_string("sound/type") == "winsynth":
self.g_device_radio.set_active(True)
else:
self.g_fakesynth_radio.set_active(True)
gu.bButton(page_vbox, _("_Test"), self.on_apply_and_play_test_sound, False)
def generate_entries(self):
self.title_entry = Gtk.Entry()
self.title_entry.set_placeholder_text('Full title of the course')
self.catalog_entry = Gtk.Entry()
self.catalog_entry.set_placeholder_text('E.g. COMS 101')
self.credits_spinner = Gtk.SpinButton.new_with_range(1,6,1)
self.credits_spinner.set_digits(0)
self.credits_spinner.set_numeric(True)
self.credits_spinner.set_snap_to_ticks(True)
self.credits_spinner.set_value(1)
# Box to hold prereq entries and buttons
self.prereqs_box = Gtk.Box()
self.prereqs_box.set_margin_top(5)
self.prereqs_box.set_margin_bottom(5)
# Box to hold prereq entry
self.prereq_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.change_buttons_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.prereq_box.pack_start(Gtk.Entry(), True, True, 0)
self.change_buttons_box.pack_start(self.create_change_box(), True, True, 0)
self.prereqs_box.pack_start(self.prereq_box, True, True, 0)
self.prereqs_box.pack_end(self.change_buttons_box, True, True, 0)
self.time_box = Gtk.Box()
self.time_box.set_homogeneous(True)
self.year_selector = Gtk.ComboBoxText()
self.quarter_selector = Gtk.ComboBoxText()
for year in range(1,6):
self.year_selector.append_text(str(year))
for quarter in ['Fall','Winter','Spring','Summer']:
self.quarter_selector.append_text(quarter)
self.time_box.pack_start(self.year_selector, True, True, 0)
self.time_box.pack_start(self.quarter_selector, True, True, 0)
self.course_type_selector = Gtk.ComboBoxText()
for c_type in ['Major','Support','Concentration','General Ed','Free Elective','Minor']:
self.course_type_selector.append_text(c_type)
# Box to hold GE selectors and buttons
self.ge_box = Gtk.Box()
self.ge_box.set_margin_top(5)
self.ge_box.set_margin_bottom(5)
# Box to hold GE selector
self.ge_type_selector_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.ge_type_selector_box.pack_start(self.generate_ge_selector(), True, True, 0)
self.ge_box.pack_start(self.ge_type_selector_box, True, True, 0)
self.ge_buttons_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.ge_buttons_box.pack_start(self.create_change_box("ge"), True, True, 0)
self.ge_box.pack_end(self.ge_buttons_box, True, True, 0)
self.notes_entry = Gtk.Entry()
def __init__(self, parent, courses, user):
Gtk.Dialog.__init__(self, "Preferences", parent,
0, (Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
self.set_size_request(400, -1)
self.planned_ges = courses
self.ge_list = [
'A1', 'A2', 'A3',
'B1', 'B2', 'B3', 'B4', 'B5', 'B6',
'C1', 'C2', 'C3', 'C4', 'C5',
'D1', 'D2', 'D3', 'D4/E', 'D5',
'F'
]
self.ge_length = len(self.ge_list)
self.notebook = Gtk.Notebook()
self.box = self.get_content_area()
self.box.add(self.notebook)
self.user = Gtk.Grid()
self.user.set_column_homogeneous(True)
self.user.attach(Gtk.Label("Year:"), 0, 0, 1, 1)
self.year_selector = Gtk.ComboBoxText()
self.user.attach(self.year_selector, 1, 0, 1, 1)
for x in range(1,7):
self.year_selector.append_text(str(x))
self.year_selector.set_active(user['year']-1)
self.user.attach(Gtk.Label("Years to display:"), 0, 1, 1, 1)
self.display_years_selector = Gtk.ComboBoxText()
self.user.attach(self.display_years_selector, 1, 1, 1, 1)
for x in range(1,7):
self.display_years_selector.append_text(str(x))
self.display_years_selector.set_active(user['display_years']-1)
self.notebook.append_page(self.user, Gtk.Label("User Info"))
self.ges = Gtk.Grid()
self.ges.set_column_homogeneous(True)
for pos, ge in enumerate(self.ge_list):
self.ges.attach(Gtk.Label(ge), 0, pos, 1, 1)
if ge in self.planned_ges:
self.ges.attach(editable_label(self.planned_ges[ge]), 1, pos, 1, 1)
else:
self.ges.attach(editable_label(), 1, pos, 1, 1)
self.notebook.append_page(self.ges, Gtk.Label("GEs"))
self.show_all()
def create_set_res_window(self):
self.set_res_window = Gtk.Window(
title = _("Konung 2: Blood of Titans"),
type = Gtk.WindowType.TOPLEVEL,
window_position = Gtk.WindowPosition.CENTER_ALWAYS,
resizable = False,
default_width = 360
)
self.set_res_window.connect('delete-event', self.quit_app)
grid = Gtk.Grid(
margin_left = 10,
margin_right = 10,
margin_top = 10,
margin_bottom = 10,
row_spacing = 10,
column_spacing = 10,
column_homogeneous = True,
)
label_custom_res = Gtk.Label(
label = _("Custom resolution:")
)
self.combobox_resolution = Gtk.ComboBoxText()
resolutions_list = sorted(os.listdir(game_dir + '/res_patch'))
for resolution in resolutions_list:
self.combobox_resolution.append_text(resolution)
self.combobox_resolution.set_active(self.resolution)
self.combobox_resolution.connect('changed', self.cb_combobox_resolution)
button_save = Gtk.Button(
label = _("Save and quit"),
)
button_save.connect('clicked', self.cb_button_save)
grid.attach(label_custom_res, 0, 0, 1, 1)
grid.attach(self.combobox_resolution, 1, 0, 1, 1)
grid.attach(button_save, 0, 2, 2, 1)
self.set_res_window.add(grid)
def create_set_res_window(self):
self.set_res_window = Gtk.Window(
title = _("Nosferatu: The Wrath of Malachi"),
type = Gtk.WindowType.TOPLEVEL,
window_position = Gtk.WindowPosition.CENTER_ALWAYS,
resizable = False,
default_width = 360
)
self.set_res_window.connect('delete-event', self.quit_app)
grid = Gtk.Grid(
margin_left = 10,
margin_right = 10,
margin_top = 10,
margin_bottom = 10,
row_spacing = 10,
column_spacing = 10,
column_homogeneous = True,
)
label_custom_res = Gtk.Label(
label = _("Custom resolution:")
)
self.combobox_resolution = Gtk.ComboBoxText()
resolutions_list = sorted(os.listdir(game_dir + '/res_patch'))
for resolution in resolutions_list:
self.combobox_resolution.append_text(resolution)
self.combobox_resolution.set_active(self.resolution)
self.combobox_resolution.connect('changed', self.cb_combobox_resolution)
button_save = Gtk.Button(
label = _("Save and quit"),
)
button_save.connect('clicked', self.cb_button_save)
grid.attach(label_custom_res, 0, 0, 1, 1)
grid.attach(self.combobox_resolution, 1, 0, 1, 1)
grid.attach(button_save, 0, 2, 2, 1)
self.set_res_window.add(grid)
def create_set_res_window(self):
self.set_res_window = Gtk.Window(
title = _("Desperados: Wanted Dead or Alive"),
type = Gtk.WindowType.TOPLEVEL,
window_position = Gtk.WindowPosition.CENTER_ALWAYS,
resizable = False,
default_width = 360
)
self.set_res_window.connect('delete-event', self.quit_app)
grid = Gtk.Grid(
margin_left = 10,
margin_right = 10,
margin_top = 10,
margin_bottom = 10,
row_spacing = 10,
column_spacing = 10,
column_homogeneous = True,
)
label_custom_res = Gtk.Label(
label = _("Custom resolution:")
)
self.combobox_resolution = Gtk.ComboBoxText()
resolutions_list = sorted(os.listdir(game_dir + '/res_patch'))
for resolution in resolutions_list:
self.combobox_resolution.append_text(resolution)
self.combobox_resolution.set_active(self.resolution)
self.combobox_resolution.connect('changed', self.cb_combobox_resolution)
button_save = Gtk.Button(
label = _("Save and quit"),
)
button_save.connect('clicked', self.cb_button_save)
grid.attach(label_custom_res, 0, 0, 1, 1)
grid.attach(self.combobox_resolution, 1, 0, 1, 1)
grid.attach(button_save, 0, 2, 2, 1)
self.set_res_window.add(grid)
def create_main_window(self):
self.main_window = Gtk.Window(
title = _("Corsairs Gold"),
type = Gtk.WindowType.TOPLEVEL,
window_position = Gtk.WindowPosition.CENTER_ALWAYS,
resizable = False,
)
self.main_window.connect('delete-event', self.quit_app)
grid = Gtk.Grid(
margin_left = 10,
margin_right = 10,
margin_top = 10,
margin_bottom = 10,
row_spacing = 10,
column_spacing = 10,
column_homogeneous = True,
)
label_lang = Gtk.Label(
label = _("Language:")
)
lang_list = ['Dutch', 'English', 'German', 'French', 'Italian', 'Polish',
'Portuguese', 'Spanish']
combobox_lang = Gtk.ComboBoxText()
index = 1
for i in range(len(lang_list)):
combobox_lang.append_text(lang_list[i])
if self.lang == lang_list[i]:
index = i
combobox_lang.set_active(index)
combobox_lang.connect('changed', self.cb_combobox_lang)
button_save = Gtk.Button(
label = _("Save and quit")
)
button_save.connect('clicked', self.cb_button_save)
grid.attach(label_lang, 0, 0, 1, 1)
grid.attach(combobox_lang, 1, 0, 1, 1)
grid.attach(button_save, 0, 1, 2, 1)
self.main_window.add(grid)
self.main_window.show_all()
def create_set_res_window(self):
self.set_res_window = Gtk.Window(
title = _("Konung: Legends of the North"),
type = Gtk.WindowType.TOPLEVEL,
window_position = Gtk.WindowPosition.CENTER_ALWAYS,
resizable = False,
default_width = 360
)
self.set_res_window.connect('delete-event', self.quit_app)
grid = Gtk.Grid(
margin_left = 10,
margin_right = 10,
margin_top = 10,
margin_bottom = 10,
row_spacing = 10,
column_spacing = 10,
column_homogeneous = True,
)
label_custom_res = Gtk.Label(
label = _("Custom resolution:")
)
self.combobox_resolution = Gtk.ComboBoxText()
resolutions_list = sorted(os.listdir(game_dir + '/res_patch'))
for resolution in resolutions_list:
self.combobox_resolution.append_text(resolution)
self.combobox_resolution.set_active(self.resolution)
self.combobox_resolution.connect('changed', self.cb_combobox_resolution)
button_save = Gtk.Button(
label = _("Save and quit"),
)
button_save.connect('clicked', self.cb_button_save)
grid.attach(label_custom_res, 0, 0, 1, 1)
grid.attach(self.combobox_resolution, 1, 0, 1, 1)
grid.attach(button_save, 0, 2, 2, 1)
self.set_res_window.add(grid)
def _build_audio_vbox(self):
"""
"""
title = Gtk.Label("Audio Source")
title.set_margin_top(6)
self.mic_sources = Gtk.ComboBoxText()
for source in self.pipeline.audio_sources:
self.mic_sources.append_text(source.description)
self.sources_list.append(source.description)
self.mic_sources.connect("changed", self.on_input_change)
self.mic_sources.set_margin_left(24)
self.mute_checkbutton = Gtk.CheckButton("Mute (soon)")
self.mute_checkbutton.connect("toggled", self.on_mute_toggle)
self.mute_checkbutton.set_sensitive(False)
self.output_sinks = Gtk.ComboBoxText()
index = 0
for description, device in self.pipeline.speaker_sinks.items():
self.output_sinks.append_text(description)
self.sinks_list.append(description)
if device == self.pipeline.speaker_sink.get_property("device"):
self.output_sinks.set_active(index)
index += 1
self.output_sinks.connect("changed", self.on_output_change)
self.output_sinks.set_margin_left(24)
self.audio_confirm_button = self._build_confirm_changes_button(
callback=self.on_confirm_clicked)
separator = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
separator.set_margin_top(6)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
vbox.set_margin_right(6)
_pack_widgets(vbox,
title,
self.mic_sources,
self.mute_checkbutton,
self.output_sinks,
self.audio_confirm_button,
separator)
self._make_scrolled_window(vbox)
return vbox
def _build_settings_vbox(self):
title = Gtk.Label("Settings")
title.set_margin_bottom(6)
self.text_overlay_entry = Gtk.Entry()
self.text_overlay_entry.set_placeholder_text("Text displayed on screen")
self.text_overlay_entry.set_width_chars(30)
self.text_overlay_entry.connect("changed", self.on_text_change)
self.text_overlay_entry.set_sensitive(True) # DEV
self.text_position_combobox = Gtk.ComboBoxText()
for position in self.positions:
self.text_position_combobox.append_text(position)
self.text_position_combobox.set_active(0)
self.text_position_combobox.set_margin_left(24)
self.text_position_combobox.set_sensitive(False) # DEV
self.hide_text_checkbutton = Gtk.CheckButton("Hide Text")
self.hide_text_checkbutton.connect("toggled", self.on_hide_text_toggle)
self.image_chooser_button = Gtk.FileChooserButton()
self.image_chooser_button.set_title("Select an image to display")
self.image_chooser_button.connect("file-set", self.on_image_selected)
self.image_chooser_button.set_sensitive(True) # DEV
self.image_position_combobox = Gtk.ComboBoxText()
for position in self.positions:
self.image_position_combobox.append_text(position)
self.image_position_combobox.set_active(1)
self.image_position_combobox.set_margin_left(24)
self.image_position_combobox.set_sensitive(False) # DEV
self.hide_image_checkbutton = Gtk.CheckButton("Hide Image")
self.hide_image_checkbutton.connect(
"toggled", self.on_hide_image_toggle)
self.settings_confirm_button = self._build_confirm_changes_button(
callback=self.on_confirm_clicked)
self.settings_confirm_button.set_label("Confirm")
self.settings_confirm_button.set_size_request(250, 20)
separator = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
separator.set_margin_top(6)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
vbox.set_margin_right(6)
_pack_widgets(vbox,
title,
self.text_overlay_entry,
self.text_position_combobox,
self.hide_text_checkbutton,
self.image_chooser_button,
self.image_position_combobox,
self.hide_image_checkbutton,
self.settings_confirm_button,
separator)
self._make_scrolled_window(vbox)
return vbox