You are not logged in.

#1 2021-02-27 14:37:46

beng
Member
Registered: 2015-09-29
Posts: 71

[SOLVED] How / where to translate exit dialog buttons?

Hi
sorry this must be obvious but I couldn't find where i can edit the wording of the 5 buttons:
- Log out
- Lock screen
- Suspend
- Reboot
- & Power off
in the exit dialog (so that I can simply translate them)?
(obviously not in bl-exit)
Thanks a lot in advance.
beng

Last edited by beng (2021-02-28 00:29:48)

Offline

#2 2021-02-27 15:20:18

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,817

Re: [SOLVED] How / where to translate exit dialog buttons?

I use my own:

/home/sector11/bin/s11-exit

#!/usr/bin/python2
# Script modified from cb_exit
# An early BunsenLabs script (bl_exit) edited for use by Sector11
# -*- coding: utf-8 -*-

import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass

dbus_send = "dbus-send --print-reply --system --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.{} boolean:true"

class s11_exit:
    def disable_buttons(self):
        self.cancel.set_sensitive(False)
#        self.suspend.set_sensitive(False)
        self.logout.set_sensitive(False)
        self.reboot.set_sensitive(False)
        self.shutdown.set_sensitive(False)

    def cancel_action(self,btn):
        self.disable_buttons()
        gtk.main_quit()

#    def suspend_action(self,btn):
#        self.disable_buttons()
#        self.status.set_label("Suspending, please standby...")
#        os.system("bl-lock")
#        os.system(dbus_send.format("Suspend"))
#        gtk.main_quit()

    def logout_action(self,btn):
        self.disable_buttons()
        self.status.set_label("Exiting Openbox, please standby...")
        os.system("openbox --exit")

    def reboot_action(self,btn):
        self.disable_buttons()
        self.status.set_label("Rebooting, please standby...")
        os.system(dbus_send.format("Reboot"))

    def shutdown_action(self,btn):
        self.disable_buttons()
        self.status.set_label("Shutting down, please standby...")
        os.system(dbus_send.format("PowerOff"))

    def create_window(self):
        self.window = gtk.Window()
#        title = "Mission over " + getpass.getuser() + ", your debrief options are:"
        title = "Mission over.  Your debrief options are:"
        self.window.set_title(title)
        self.window.set_border_width(5)
        self.window.set_size_request(500, 80)
        self.window.set_resizable(False)
        self.window.set_keep_above(True)
        self.window.stick
        self.window.set_position(1)
        self.window.connect("delete_event", gtk.main_quit)
        windowicon = self.window.render_icon(gtk.STOCK_QUIT, gtk.ICON_SIZE_MENU)
        self.window.set_icon(windowicon)


        #Create HBox for buttons
        self.button_box = gtk.HBox()
        self.button_box.show()

        #Cancel button
        self.cancel = gtk.Button(stock = gtk.STOCK_CANCEL)
        self.cancel.set_border_width(4)
        self.cancel.connect("clicked", self.cancel_action)
        self.button_box.pack_start(self.cancel)
        self.cancel.show()

        #Cancel key (Escape)
        accelgroup = gtk.AccelGroup()
        self.key, self.mod = gtk.accelerator_parse('Escape')
        accelgroup.connect_group(self.key, self.mod, gtk.ACCEL_VISIBLE, gtk.main_quit)
        self.window.add_accel_group(accelgroup)

        #Suspend button
#        self.suspend = gtk.Button("_Suspend")
#        self.suspend.set_border_width(4)
#        self.suspend.connect("clicked", self.suspend_action)
#        self.button_box.pack_start(self.suspend)
#        self.suspend.show()

        #Logout button
        self.logout = gtk.Button("_Punch Out")
        self.logout.set_border_width(4)
        self.logout.connect("clicked", self.logout_action)
        self.button_box.pack_start(self.logout)
        self.logout.show()

        #Reboot button
        self.reboot = gtk.Button("_Restart Engines")
        self.reboot.set_border_width(4)
        self.reboot.connect("clicked", self.reboot_action)
        self.button_box.pack_start(self.reboot)
        self.reboot.show()

        #Shutdown button
        self.shutdown = gtk.Button("_Cut Engines")
        self.shutdown.set_border_width(4)
        self.shutdown.connect("clicked", self.shutdown_action)
        self.button_box.pack_start(self.shutdown)
        self.shutdown.show()

        #Create HBox for status label
        self.label_box = gtk.HBox()
        self.label_box.show()
        self.status = gtk.Label()
        self.status.show()
        self.label_box.pack_start(self.status)

        #Create VBox and pack the above HBox's
        self.vbox = gtk.VBox()
        self.vbox.pack_start(self.button_box)
        self.vbox.pack_start(self.label_box)
        self.vbox.show()

        self.window.add(self.vbox)
        self.window.show()

    def __init__(self):
        self.create_window()

def main():
    gtk.main()

if __name__ == "__main__":
    go = s11_exit()
    main()

and call it in OB Menu:

s11-exit

as it is executable and in my PATH

2021-02-27-123059-S11.jpg

EDIT: Added image

Last edited by Sector11 (2021-02-27 15:24:49)


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#3 2021-02-27 23:36:24

beng
Member
Registered: 2015-09-29
Posts: 71

Re: [SOLVED] How / where to translate exit dialog buttons?

Hi Sector11
Thanks a lot for your help but really I just want to edit the wording of the buttons, that will do for me.
beng

[EDIT] Sorted!
in bl-exit, just need to edit
yad_gui() {
   yad --class=WmanExit --title "Exit" --close-on-unfocus --undecorated --center --on-top --borders=10 --window-icon=system-log-out \
        --button=" _Logout!system-log-out!Logout":'bash -c "logoutctl terminate-session"' \
        --button=" L_ock Screen!system-lock-screen!":'bash -c "logoutctl lock-session"' \
        --button=" _Suspend!system-suspend!":'bash -c "logoutctl suspend"' \
        --button=" Re_boot!system-reboot!":'bash -c "logoutctl reboot"' \
        --button=" _Power Off!system-shutdown!":'bash -c "logoutctl poweroff"'
}

Last edited by beng (2021-02-28 00:29:00)

Offline

Board footer

Powered by FluxBB