使用glade的bash上的GUI

我想为我的PC制作一个遥控器。基本上我需要的是在点击按钮上运行命令。继此guide我设法建立了layout,这是我所梦想的一切。 但是当我尝试使用使用glade的bash上的GUI

gtkdialog -g test.glade -p MainWindow 

这种情况

(gtkdialog:18284): libglade-WARNING **: Expected <glade-interface>. Got <interface>. 

(gtkdialog:18284): libglade-WARNING **: did not finish in PARSER_FINISH state

(gtkdialog:18284): libglade-CRITICAL **: glade_xml_get_widget: assertion 'self != NULL' failed

(gtkdialog:18284): ERROR **: Can not load 'MainWindow' from file 'test.glade'

而在这之后没有什么发生运行它.. 有没有一种更简单的方法来做到这一点?

我的想法是将该程序放在一个单独的虚拟屏幕上,并使用我的手机访问它。

这是林间空地文件

<?xml version="1.0" encoding="UTF-8"?> 

<!-- Generated with glade 3.20.2 -->

<interface>

<requires lib="gtk+" version="3.20"/>

<object class="GtkWindow" id="MainWindow">

<property name="can_focus">False</property>

<child>

<object class="GtkGrid">

<property name="visible">True</property>

<property name="can_focus">False</property>

<child>

<object class="GtkButton" id="LvUP">

<property name="label" translatable="yes">Left Channel UP</property>

<property name="width_request">217</property>

<property name="height_request">154</property>

<property name="visible">True</property>

<property name="can_focus">True</property>

<property name="receives_default">True</property>

<signal name="clicked" handler="amixer -c 1 set &quot;PCM Front&quot; 5%+,0%-" swapped="no"/>

</object>

<packing>

<property name="left_attach">0</property>

<property name="top_attach">0</property>

</packing>

</child>

<child>

<object class="GtkButton" id="VolUp">

<property name="label" translatable="yes">Vol UP</property>

<property name="width_request">217</property>

<property name="visible">True</property>

<property name="can_focus">True</property>

<property name="receives_default">True</property>

<signal name="clicked" handler="pactl set-sink-volume 0 +5%" swapped="no"/>

</object>

<packing>

<property name="left_attach">1</property>

<property name="top_attach">0</property>

</packing>

</child>

<child>

<object class="GtkButton" id="RvUP">

<property name="label" translatable="yes">Right Channel UP</property>

<property name="visible">True</property>

<property name="can_focus">True</property>

<property name="receives_default">True</property>

<signal name="clicked" handler="amixer -c 1 set &quot;PCM Front&quot; 0%-,5%+" swapped="no"/>

</object>

<packing>

<property name="left_attach">2</property>

<property name="top_attach">0</property>

</packing>

</child>

<child>

<object class="GtkButton" id="prev">

<property name="label">gtk-media-previous</property>

<property name="height_request">154</property>

<property name="visible">True</property>

<property name="can_focus">True</property>

<property name="receives_default">True</property>

<property name="use_stock">True</property>

</object>

<packing>

<property name="left_attach">0</property>

<property name="top_attach">1</property>

</packing>

</child>

<child>

<object class="GtkButton" id="play">

<property name="label" translatable="yes">Play/Pause</property>

<property name="visible">True</property>

<property name="can_focus">True</property>

<property name="receives_default">True</property>

<signal name="clicked" handler="clementine -t" swapped="no"/>

</object>

<packing>

<property name="left_attach">1</property>

<property name="top_attach">1</property>

</packing>

</child>

<child>

<object class="GtkButton" id="next">

<property name="label">gtk-media-next</property>

<property name="visible">True</property>

<property name="can_focus">True</property>

<property name="receives_default">True</property>

<property name="use_stock">True</property>

<signal name="clicked" handler="clementine -f" swapped="no"/>

</object>

<packing>

<property name="left_attach">2</property>

<property name="top_attach">1</property>

</packing>

</child>

<child>

<object class="GtkButton" id="LvDown">

<property name="label" translatable="yes">Left Channel Down</property>

<property name="height_request">154</property>

<property name="visible">True</property>

<property name="can_focus">True</property>

<property name="receives_default">True</property>

<signal name="clicked" handler="amixer -c 1 set &quot;PCM Front&quot; 5%-,0%-" swapped="no"/>

</object>

<packing>

<property name="left_attach">0</property>

<property name="top_attach">2</property>

</packing>

</child>

<child>

<object class="GtkButton" id="VolDown">

<property name="label" translatable="yes">Vol Down</property>

<property name="visible">True</property>

<property name="can_focus">True</property>

<property name="receives_default">True</property>

<signal name="clicked" handler="pactl set-sink-volume 0 -5%" swapped="no"/>

</object>

<packing>

<property name="left_attach">1</property>

<property name="top_attach">2</property>

</packing>

</child>

<child>

<object class="GtkButton" id="RvDown">

<property name="label" translatable="yes">Right Channel Down</property>

<property name="visible">True</property>

<property name="can_focus">True</property>

<property name="receives_default">True</property>

<signal name="clicked" handler="amixer -c 1 set &quot;PCM Front&quot; 0%-,5%-" swapped="no"/>

</object>

<packing>

<property name="left_attach">2</property>

<property name="top_attach">2</property>

</packing>

</child>

<child>

<object class="GtkButton" id="mute">

<property name="label" translatable="yes">Mute</property>

<property name="visible">True</property>

<property name="can_focus">True</property>

<property name="receives_default">True</property>

</object>

<packing>

<property name="left_attach">0</property>

<property name="top_attach">3</property>

</packing>

</child>

<child>

<object class="GtkButton" id="foff">

<property name="label" translatable="yes">Hello Darkness, My Old Friend | foff</property>

<property name="visible">True</property>

<property name="can_focus">True</property>

<property name="receives_default">True</property>

</object>

<packing>

<property name="left_attach">1</property>

<property name="top_attach">3</property>

</packing>

</child>

<child>

<object class="GtkButton" id="hib">

<property name="label" translatable="yes">Hib3rnate</property>

<property name="visible">True</property>

<property name="can_focus">True</property>

<property name="receives_default">True</property>

</object>

<packing>

<property name="left_attach">2</property>

<property name="top_attach">3</property>

</packing>

</child>

</object>

</child>

<child type="titlebar">

<placeholder/>

</child>

</object>

</interface>

回答:

gtkdialog是一个古老的死项目,不支持现代gtkbuilder语法glade用途。应该避免这种情况,您应该使用官方绑定的语言,如pythongjs

以上是 使用glade的bash上的GUI 的全部内容, 来源链接: utcz.com/qa/258781.html

回到顶部