diff options
| author | Inokinoki <veyx.shaw@gmail.com> | 2020-09-01 10:22:36 +0200 |
|---|---|---|
| committer | Peng Wu <alexepico@gmail.com> | 2020-09-02 11:40:12 +0800 |
| commit | 3de68dd731aeae11e1930a1f25ecdad3b2cc50d8 (patch) | |
| tree | 9ee3e034a9e73464c9b87d94fa5d31bc19ce92a7 /setup | |
| parent | ad748051706038cf4178be3f0cdbdd209fa02742 (diff) | |
| download | ibus-libpinyin-3de68dd731aeae11e1930a1f25ecdad3b2cc50d8.tar.gz ibus-libpinyin-3de68dd731aeae11e1930a1f25ecdad3b2cc50d8.tar.xz ibus-libpinyin-3de68dd731aeae11e1930a1f25ecdad3b2cc50d8.zip | |
Add Cloud Input configuration items in setup UI
Co-authored-by: lianna07 <liannaxu07@gmail.com>
Co-authored-by: Peng Wu <alexepico@gmail.com>
Diffstat (limited to 'setup')
| -rw-r--r-- | setup/ibus-libpinyin-preferences.ui | 219 | ||||
| -rw-r--r-- | setup/main2.py | 69 |
2 files changed, 283 insertions, 5 deletions
diff --git a/setup/ibus-libpinyin-preferences.ui b/setup/ibus-libpinyin-preferences.ui index e4f970a..562616a 100644 --- a/setup/ibus-libpinyin-preferences.ui +++ b/setup/ibus-libpinyin-preferences.ui @@ -30,6 +30,20 @@ </row> </data> </object> + <object class="GtkListStore" id="liststoreCloudInputSource"> + <columns> + <!-- column-name cloud_Input_source --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">Baidu</col> + </row> + <row> + <col id="0" translatable="yes">Google</col> + </row> + </data> + </object> <object class="GtkListStore" id="liststoreDisplayStyle"> <columns> <!-- column-name orientation --> @@ -141,9 +155,6 @@ <property name="window_position">center-always</property> <property name="icon_name">gtk-preferences</property> <property name="type_hint">normal</property> - <child> - <placeholder/> - </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="visible">True</property> @@ -1175,6 +1186,105 @@ <property name="position">2</property> </packing> </child> + <child> + <object class="GtkFrame" id="frameCloudInput"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkVBox" id="vbox17"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="InitEnableCloudInput"> + <property name="label" translatable="yes">Enable Cloud Input</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="xalign">0.5</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox11"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkLabel" id="label41"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Source From:</property> + <property name="use_markup">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="CloudInputSource"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">False</property> + <property name="model">liststoreCloudInputSource</property> + <property name="button_sensitivity">on</property> + <child> + <object class="GtkCellRendererText" id="renderer7"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label36"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b>Cloud Input Option</b></property> + <property name="use_markup">True</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">4</property> + </packing> + </child> </object> </child> </object> @@ -1515,6 +1625,105 @@ <property name="position">2</property> </packing> </child> + <child> + <object class="GtkFrame" id="frameBopomofoCloudInput"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkVBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="InitEnableBopomofoCloudInput"> + <property name="label" translatable="yes">Enable Cloud Input</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="xalign">0.5</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkHBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Source From:</property> + <property name="use_markup">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="BopomofoCloudInputSource"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">False</property> + <property name="model">liststoreCloudInputSource</property> + <property name="button_sensitivity">on</property> + <child> + <object class="GtkCellRendererText"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b>Cloud Input Option</b></property> + <property name="use_markup">True</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">4</property> + </packing> + </child> </object> </child> </object> @@ -2326,7 +2535,7 @@ koterpilla, Zerng07, Hillwood Yang </child> </object> <packing> - <property name="position">7</property> + <property name="position">8</property> </packing> </child> <child type="tab"> @@ -2336,7 +2545,7 @@ koterpilla, Zerng07, Hillwood Yang <property name="label" translatable="yes">About</property> </object> <packing> - <property name="position">7</property> + <property name="position">8</property> <property name="tab_fill">False</property> </packing> </child> diff --git a/setup/main2.py b/setup/main2.py index d40f6f3..4102940 100644 --- a/setup/main2.py +++ b/setup/main2.py @@ -85,6 +85,7 @@ class PreferencesDialog: self.__init_dictionary() self.__init_user_data() self.__init_shortcut() + self.__init_cloud_input() self.__init_about() elif engine == "libbopomofo": self.__config_namespace = "com.github.libpinyin.ibus-libpinyin.libbopomofo" @@ -95,6 +96,7 @@ class PreferencesDialog: self.__init_dictionary() #self.__init_user_data() self.__init_shortcut() + self.__init_bopomofo_cloud_input() self.__init_about() self.__convert_fuzzy_pinyin_to_bopomofo() self.__display_style_box.hide() @@ -114,6 +116,7 @@ class PreferencesDialog: self.__page_dictionary = self.__builder.get_object("pageDictionary") self.__page_user_data = self.__builder.get_object("pageUserData") self.__page_shortcut = self.__builder.get_object("pageShortcut") + self.__frame_cloud_input = self.__builder.get_object("frameCloudInput") self.__page_about = self.__builder.get_object("pageAbout") self.__page_general.hide() @@ -122,6 +125,7 @@ class PreferencesDialog: self.__page_fuzzy.hide() self.__page_dictionary.hide() self.__page_user_data.hide() + self.__frame_cloud_input.hide() self.__page_about.hide() def __init_general(self): @@ -487,6 +491,71 @@ class PreferencesDialog: def __shortcut_changed_cb(self, editor, key, value): self.__set_value(key, value) + def __init_bopomofo_cloud_input(self): + # page Bopomofo CloudInput + self.__frame_cloud_input = self.__builder.get_object("frameBopomofoCloudInput") + + # init state + self.__init_enable_cloud_input = self.__builder.get_object("InitEnableBopomofoCloudInput") + + # cloud input option + self.__cloud_input_source = self.__builder.get_object("BopomofoCloudInputSource") + + # read values + self.__init_enable_cloud_input.set_active(self.__get_value("enable-cloud-input")) + + self.__cloud_input_source.set_active(self.__get_value("cloud-input-source")) + + if self.__init_enable_cloud_input.get_active(): + self.__cloud_input_source.set_sensitive(True) + else: + self.__cloud_input_source.set_sensitive(False) + + # connect signals + def __enable_cloud_input_cb(widget): + val = widget.get_active() + self.__set_value("enable-cloud-input", val) + self.__cloud_input_source.set_sensitive(val) + + def __cloud_input_source_changed_cb(widget): + self.__set_value("cloud-input-source", widget.get_active()) + + self.__init_enable_cloud_input.connect("toggled", __enable_cloud_input_cb) + self.__cloud_input_source.connect("changed", __cloud_input_source_changed_cb) + + + def __init_cloud_input(self): + # page CloudInput + self.__frame_cloud_input.show() + + # init state + self.__init_enable_cloud_input = self.__builder.get_object("InitEnableCloudInput") + + # cloud input option + self.__cloud_input_source = self.__builder.get_object("CloudInputSource") + + # read values + self.__init_enable_cloud_input.set_active(self.__get_value("enable-cloud-input")) + + self.__cloud_input_source.set_active(self.__get_value("cloud-input-source")) + + if self.__init_enable_cloud_input.get_active(): + self.__cloud_input_source.set_sensitive(True) + else: + self.__cloud_input_source.set_sensitive(False) + + # connect signals + def __enable_cloud_input_cb(widget): + val = widget.get_active() + self.__set_value("enable-cloud-input", val) + self.__cloud_input_source.set_sensitive(val) + + def __cloud_input_source_changed_cb(widget): + self.__set_value("cloud-input-source", widget.get_active()) + + self.__init_enable_cloud_input.connect("toggled", __enable_cloud_input_cb) + self.__cloud_input_source.connect("changed", __cloud_input_source_changed_cb) + def __init_about(self): # page About self.__page_about.show() |
