set UI btns with one or 2 plugins

plugins
papajoker 2019-11-27 21:44:44 +01:00
parent 6c63bfe2a6
commit f63252cd97
2 changed files with 67 additions and 30 deletions

View File

@ -74,7 +74,7 @@ class Hello(Gtk.Window):
widget.get_image_position() is Gtk.PositionType.RIGHT: widget.get_image_position() is Gtk.PositionType.RIGHT:
img = Gtk.Image.new_from_file( img = Gtk.Image.new_from_file(
self.preferences["data_path"] + "img/external-link.png") self.preferences["data_path"] + "img/external-link.png")
img.set_margin_left(2) img.set_margin_start(2)
widget.set_image(img) widget.set_image(img)
# Create pages # Create pages
@ -106,18 +106,33 @@ class Hello(Gtk.Window):
# Installed systems # Installed systems
else: else:
if APPS_PLUGIN: if APPS_PLUGIN:
conf = HelloConfig(application="manjaro-hello") try:
app_browser = ApplicationBrowser(conf, self) conf = HelloConfig(application="manjaro-hello")
# create page install Applications app_browser = ApplicationBrowser(conf, self)
self.builder.get_object("stack").add_named(app_browser, "appBrowserpage") # create page install Applications
self.builder.get_object("appBrowser").set_visible(True) self.builder.get_object("stack").add_named(app_browser, "appBrowserpage")
self.builder.get_object("appBrowser").set_visible(True)
except Exception as err:
print("Error Application utility:", err)
try: try:
#self.builder.get_object("appBrowser").set_visible(True) # for test with 2 btns
from layoutswitcherlib.layoutsbox import LayoutBox from layoutswitcherlib.layoutsbox import LayoutBox
app_layout = LayoutBox(self, usehello=True) try:
self.builder.get_object("stack").add_named(app_layout, "appLayoutspage") app_layout = LayoutBox(self, usehello=True)
self.builder.get_object("appLayouts").set_visible(True) # show btn in UI self.builder.get_object("stack").add_named(app_layout, "appLayoutspage")
if not self.builder.get_object("appBrowser").props.visible: #if APPS_PLUGIN:
btn = self.builder.get_object("appLayouts")
btn.set_margin_start(200)
btn.set_margin_end(200)
self.builder.get_object("appLayouts").set_visible(True) # show btn in UI
except Exception as err:
print("Error Gnome Manager:", err)
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"Info: Application Gnome Layout Switcher plugin not found : {e}") print(f"Info: Application Gnome Layout Switcher plugin not found : {e}")
if self.builder.get_object("appBrowser").props.visible and not self.builder.get_object("appLayouts").props.visible: #if :
btn = self.builder.get_object("appBrowser")
btn.set_margin_start(200)
btn.set_margin_end(200)
self.window.show() self.window.show()

View File

@ -503,25 +503,53 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="appBrowser"> <object class="GtkBox">
<property name="label" translatable="yes">Applications</property>
<property name="name">appBrowser</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="receives_default">True</property> <property name="visible">True</property>
<property name="tooltip_text" translatable="yes">Common application selection</property> <property name="name">boxPlugins</property>
<signal name="clicked" handler="on_btn_clicked" swapped="no"/> <property name="spacing">0</property>
</object> <property name="homogeneous">True</property>
<object class="GtkButton" id="appLayouts"> <child>
<property name="label" translatable="yes">Layouts switcher</property> <object class="GtkButton" id="appBrowser">
<property name="name">appLayouts</property> <property name="label" translatable="yes">Applications</property>
<property name="can_focus">False</property> <property name="name">appBrowser</property>
<property name="receives_default">True</property> <property name="visible">False</property>
<property name="tooltip_text" translatable="yes">Manjaro Gnone config tool</property> <property name="can_focus">False</property>
<signal name="clicked" handler="on_btn_clicked" swapped="no"/> <property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Common application selection</property>
<property name="margin_left">15</property>
<property name="margin_right">15</property>
<signal name="clicked" handler="on_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="appLayouts">
<property name="label" translatable="yes">Gnome Layouts Manager</property>
<property name="name">appLayouts</property>
<property name="visible">False</property>
<property name="can_focus">False</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Manjaro Gnone config tool</property>
<property name="margin_left">15</property>
<property name="margin_right">15</property>
<signal name="clicked" handler="on_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">0</property>
<property name="top_attach">8</property> <property name="top_attach">8</property>
<property name="width">3</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -530,12 +558,6 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
<packing> <packing>
<property name="name">homepage</property> <property name="name">homepage</property>