Re: [qubes-users] qubes manager add start terminal

2017-04-19 Thread Manuel Amador (Rudd-O)
On 04/16/2017 11:29 PM, Eva Star wrote:
> I'm get tired that Qubes Manager till now do NOT have "Start Terminal"
> at right click menu of each vm, but only "Run command in VM".
>
> I want to patch it to add "Run terminal". I found that need to
> duplicate "Run command" entry, name it "Run Terminal" and predefined
> "gnome-terminal" on the input field.
>
> I need to modify action. On the repository I see actions at
> mainwindow.ui file. But I can not find it on the disk to add new action!
>
> 
>
> 
>  :/run-command.png:/run-command.png
> 
>
> Where is mainwindow.ui with actions???
>
> If I will found it I will add new function to process this action by
> duplicating action_run_command_in_vm_triggered(self) and predefined
> "gnome-terminal" into it.
>
>

Predefine "gnome-terminal || konsole || xterm" for more compatibility.

-- 
Rudd-O
http://rudd-o.com/

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/4624e592-9cb2-fbf7-c4fe-06a7fb486fe1%40rudd-o.com.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] qubes manager add start terminal

2017-04-17 Thread Eva Star
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 04/18/2017 01:13 AM, Unman wrote:

> 
> unman
> 

Thanks for this detailed manual, again, problem was with actions. I
will try later to do all of that. I think with your manual almost
somebody can do the same now.

- -- 
Regards
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQIcBAEBCAAGBQJY9U2KAAoJEGSin3PC/C0ASB4P/2evYbd3CuI9XCzAF5SHuHe3
AdoUMJSW2MSZV1a126ONQWOKAwZ8YcuTLlKw55kk4Zu9jwU8wMJGkGJGPY9skCeA
welOhemlh3kZKixKM7ZH0h11J3d+YL54v62dOgrE3BgYkArePvjcfPgWh7lmIuRm
1WDrRE5XQ1vDhw8HkyI3lr5kppwMIVzUB0N4DEwSLwnj9VHMtiz8vAV00sG4Pf3F
l0n9Ox5pgpassN23QIyIuOLR9LNCLMmm2oY6ltgarJwOFugqi26IJgR5TJhIYOST
SseM9f0InA66lI6i/p2KdzW2WZrZel2Y99f55oxeGVQxj0iHmGd9LXmlVSUkcerN
TZzAJ88KKQfPqQt10MML/tGAWwCaM/PRa6Qdxdvg2SdniVWH0EQdeg/aqfIg/AVr
pw+2NHZokx/907QB/V92F6yAlUBjW/GoftgSVyLhGaO9GS7vzyO30e/5KIZ6gwlN
VfpUJ8UIgHU4mcmopaGbtBZYW+6T5xg4vOALAUwEcIGb1Dt+xysgIGxo9xVz6wva
cBeaR7O2iluXQ0Twv7TS4B9PBowKcFzIYc7TqbJl33CVPh42NgLbQCF12DtYbczB
sj0RwzbEsdN0uj76Gk575bzQXclWhiVRng5RTwS3QAYCvufXGWvXqwpeOLfo+i89
ZzkFEKGQFkmKEUS4ITJW
=ai/A
-END PGP SIGNATURE-

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/85ba0b7d-7565-9dab-82c4-b773c454966c%40openmailbox.org.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] qubes manager add start terminal

2017-04-17 Thread Unman
On Mon, Apr 17, 2017 at 04:39:14PM +0300, Eva Star wrote:
> On 04/17/2017 03:11 AM, Unman wrote:
> 
> >I've done some manager hacking myself - some of it now incorporated in
> >release.
> >If you dont want to build a package then you can simply start hacking in
> >/usr/lib64/python2.7/site-packages/qubesmanager.
> >(Back this up first, of course.)
> >
> >Beside the ui elements in ui_mainwindow the slots are in main.py. If
> >you're going to hack these remember to remove the compiled files.
> >I'd recommend using xterm, as it's in all the templates afaik.
> >
> 
> Unfortunately main.py contain only functions.
> UI elements located not at qubesmanager dir. They are compiled? How?
> Need to modify this file :
> https://github.com/QubesOS/qubes-manager/blob/master/mainwindow.ui
> 
> 
> 
Eva,

You've actually quoted the part where I tell you where the ui elements
are.

You can make this change directly in dom0 without building a package, by
editing the code in /usr/lib64/python2.7/site-packages/qubesmanager

As I said, main.py contains the slots (functions) and also the signals
that trigger them.

The simplest way to do what you want is to use the "Run command in VM"
structure as a template. You can search "command" and see how that is
implemented, and adapt it for your new purpose.


1. Define the function:
Copy the section defining the slot
(@pyqtSlot(name='on_action_run_command_in_vm_triggered'))
and the static method:
def do_run_command_in_vm(vm, command_to_run, thread_monitor):


You can pretty much just replace "command" with "xterm" throughout the
slot, and simplify because you arent prompting for a command to run:

@pyqtSlot(name='on_action_run_xterm_in_vm_triggered')
def action_run_xterm_in_vm_triggered(self):
vm = self.get_selected_vm()
thread_monitor = ThreadMonitor()
thread = threading.Thread(target=self.do_run_xterm_in_vm, args=(
vm, thread_monitor))
thread.daemon = True
thread.start()

while not thread_monitor.is_finished():
app.processEvents()
time.sleep(0.2)

if not thread_monitor.success:
QMessageBox.warning(None, self.tr("Error while running xterm"),
unicode(self.tr("Exception while running 
xterm:{0}")).format(
thread_monitor.error_msg))

@staticmethod
def do_run_xterm_in_vm(vm, thread_monitor):
try:
vm.run('xterm', verbose=False, autostart=True,
   notify_function=lambda lvl, msg: trayIcon.showMessage(
   msg, msecs=3000))
except Exception as ex:
thread_monitor.set_error_msg(str(ex))
thread_monitor.set_finished()


2. Enable it when a row is selected.
Go to the table_selection_changed(self) function, and add in the new
function:
(again you can copy the action_run_command_in_vm details).
So in the main body of the function add:
self.action_run_xterm_in_vm.setEnabled(
not vm.last_power_state == "Paused" and vm.qid != 0)
and in the else clause:
self.action_run_xterm_in_vm.setEnabled(False)

3. Create the context menu item:
In __init__ section,
add a line below the line that adds the action_run_command_in_vm:
self.context_menu.addAction(self.action_run_xterm_in_vm)


4. 
That's almost it:
But you need to add the new action to the Window. Again, you can look at
how action_run_command_in_vm is managed, and adapt it for your new menu
item. At a minimum you'll want entries in the setup and retranslate
functions.
So you'll want to add:
self.action_run_xterm_in_vm = QtGui.QAction(VmManagerWindow)

self.action_run_xterm_in_vm.setObjectName(_fromUtf8("action_run_xterm_in_vm"))
and
self.action_run_xterm_in_vm.setText(_translate("VmManagerWindow", " 
xterm in VM", None))




That's pretty much done.

If you want to build a package just edit the files in the manager
directory, and run 'make manager'
The files you want there are qubesmanager/main.py and mainwindow.ui

As I said though, it's much simpler just to hack the source in dom0.
(Again, make sure you have backed up the originals.)

I hope this gives you the general idea - you can add all sorts of
context menus items, (including customizing the action to the VM.)

unman

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/20170417221329.GA14947%40thirdeyesecurity.org.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] qubes manager add start terminal

2017-04-17 Thread Jean-Philippe Ouellet
On Mon, Apr 17, 2017 at 9:39 AM, Eva Star  wrote:
> On 04/17/2017 03:11 AM, Unman wrote:
>
>> I've done some manager hacking myself - some of it now incorporated in
>> release.
>> If you dont want to build a package then you can simply start hacking in
>> /usr/lib64/python2.7/site-packages/qubesmanager.
>> (Back this up first, of course.)
>>
>> Beside the ui elements in ui_mainwindow the slots are in main.py. If
>> you're going to hack these remember to remove the compiled files.
>> I'd recommend using xterm, as it's in all the templates afaik.
>>
>
> Unfortunately main.py contain only functions.
> UI elements located not at qubesmanager dir. They are compiled? How?
> Need to modify this file :
> https://github.com/QubesOS/qubes-manager/blob/master/mainwindow.ui

Yes, they get "compiled" during package build like this [1]. You can
either invoke pyuic4 yourself, or just use qubes-builder to build new
qubes-manager packages and install them in dom0. I personally find the
build pkg & reinstall method easier.

[1]: 
https://github.com/QubesOS/qubes-manager/blob/46b892edb15f5fbc86b6f492ed4ffe61e2b1f491/Makefile#L19-L33

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/CABQWM_CC3FjojA8QPnq2X-oM00q5_QVetzjytqLXLxhv3yQ1Ag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] qubes manager add start terminal

2017-04-17 Thread Eva Star

On 04/17/2017 03:11 AM, Unman wrote:


I've done some manager hacking myself - some of it now incorporated in
release.
If you dont want to build a package then you can simply start hacking in
/usr/lib64/python2.7/site-packages/qubesmanager.
(Back this up first, of course.)

Beside the ui elements in ui_mainwindow the slots are in main.py. If
you're going to hack these remember to remove the compiled files.
I'd recommend using xterm, as it's in all the templates afaik.



Unfortunately main.py contain only functions.
UI elements located not at qubesmanager dir. They are compiled? How?
Need to modify this file :
https://github.com/QubesOS/qubes-manager/blob/master/mainwindow.ui



--
Regards

--
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/8dc17815-53ff-8e74-c255-1e1bd1d72c5e%40openmailbox.org.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] qubes manager add start terminal

2017-04-16 Thread Unman
On Mon, Apr 17, 2017 at 02:29:05AM +0300, Eva Star wrote:
> I'm get tired that Qubes Manager till now do NOT have "Start Terminal" at
> right click menu of each vm, but only "Run command in VM".
> 
> I want to patch it to add "Run terminal". I found that need to duplicate
> "Run command" entry, name it "Run Terminal" and predefined "gnome-terminal"
> on the input field.
> 
> I need to modify action. On the repository I see actions at mainwindow.ui
> file. But I can not find it on the disk to add new action!
> 
> 
>
> 
>  :/run-command.png:/run-command.png
> 
> 
> Where is mainwindow.ui with actions???
> 
> If I will found it I will add new function to process this action by
> duplicating action_run_command_in_vm_triggered(self) and predefined
> "gnome-terminal" into it.
> 
> 

I've done some manager hacking myself - some of it now incorporated in
release.
If you dont want to build a package then you can simply start hacking in 
/usr/lib64/python2.7/site-packages/qubesmanager.
(Back this up first, of course.)

Beside the ui elements in ui_mainwindow the slots are in main.py. If
you're going to hack these remember to remove the compiled files.
I'd recommend using xterm, as it's in all the templates afaik.

unman

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/20170417001102.GA9735%40thirdeyesecurity.org.
For more options, visit https://groups.google.com/d/optout.


[qubes-users] qubes manager add start terminal

2017-04-16 Thread Eva Star
I'm get tired that Qubes Manager till now do NOT have "Start Terminal" 
at right click menu of each vm, but only "Run command in VM".


I want to patch it to add "Run terminal". I found that need to 
duplicate "Run command" entry, name it "Run Terminal" and predefined 
"gnome-terminal" on the input field.


I need to modify action. On the repository I see actions at 
mainwindow.ui file. But I can not find it on the disk to add new action!



   

 :/run-command.png:/run-command.png


Where is mainwindow.ui with actions???

If I will found it I will add new function to process this action by 
duplicating action_run_command_in_vm_triggered(self) and predefined 
"gnome-terminal" into it.



--
Regards

--
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/f8d6b2c5-09c4-8d4a-e7fd-730f1ca74c19%40openmailbox.org.
For more options, visit https://groups.google.com/d/optout.