Exemple #1
0
 def on_remove_clicked(profile_row_i):
     dialog = gtk.MessageDialog(type=gtk.MESSAGE_QUESTION)
     dialog.set_icon_from_file(ICON_PATH)
     dialog.set_title('Remove profile')
     RESPONSE_REMOVE, RESPONSE_REMOVE_WITH_DATA, RESPONSE_CANCEL = \
         range(3)
     dialog.add_buttons('_Remove', RESPONSE_REMOVE, 'Remove with _data',
                        RESPONSE_REMOVE_WITH_DATA, 'Can_cel',
                        RESPONSE_CANCEL)
     dialog.set_markup('Remove the following profile from list?\n\n'
                       '    {}\n\n'
                       '<b>"Remove with data"</b> removes profile from '
                       'list <b>and deletes the profile '
                       'directory</b>.'.format(profile_row_i.path))
     response = dialog.run()
     dialog.destroy()
     if response not in (RESPONSE_REMOVE, RESPONSE_REMOVE_WITH_DATA):
         return
     try:
         if response == RESPONSE_REMOVE_WITH_DATA:
             dialog = gtk.MessageDialog(type=gtk.MESSAGE_QUESTION)
             dialog.set_icon_from_file(ICON_PATH)
             dialog.set_title('Confirm profile delete')
             dialog.set_markup('Remove profile data (cannot be '
                               'undone)?')
             dialog.add_buttons(gtk.STOCK_YES, gtk.RESPONSE_YES,
                                gtk.STOCK_NO, gtk.RESPONSE_NO)
             response = dialog.run()
             dialog.destroy()
             if response == gtk.RESPONSE_YES:
                 ph.path(profile_row_i.path).rmtree()
             else:
                 return
     except Exception, exception:
         gd.error(str(exception))
Exemple #2
0
 def on_DelWorkspace__activate(self, *args, **kwargs):
     opt = self.workspace_view.get_selected()
     if opt.id:
         dialogs.error(_("You can't delete a running workspace"))
     else:
         if dialogs.yesno(
           _('Do you really want to delete workspace %s ?') %opt.workspace,
             parent = self.toplevel) == gtk.RESPONSE_YES:
             from pida.core.options import OptionsManager
             OptionsManager.delete_workspace(opt.workspace)
             self.workspace_view.remove(opt)
Exemple #3
0
 def on_DelWorkspace__activate(self, *args, **kwargs):
     opt = self.workspace_view.get_selected()
     if opt.id:
         dialogs.error(_("You can't delete a running workspace"))
     else:
         if dialogs.yesno(_('Do you really want to delete workspace %s ?') %
                          opt.workspace,
                          parent=self.toplevel) == gtk.RESPONSE_YES:
             from pida.core.options import OptionsManager
             OptionsManager.delete_workspace(opt.workspace)
             self.workspace_view.remove(opt)
Exemple #4
0
    def import_profile(self, folder=None):
        # Display GTK dialog to select output directory.
        folder = gd.select_folder(folder=folder,
                                  title='Select MicroDrop '
                                  'profile directory')
        if folder is None:
            return

        try:
            verify_or_create_profile_version(folder)
        except RuntimeError, exception:
            # Major version in `RELEASE-VERSION` file and major version of
            # installed MicroDrop package **do not match**.
            gd.error(str(exception))
    def start(self):
        if not self.output_path:
            error('Please select a valid output filepath.')
            return
        self.movie_window.set_size_request(640, 480)
        self.aframe.show_all()

        # Use GStreamer WindowServiceProxy to control GStreamer video
        # pipeline.  Behind the scenes, it runs GStreamer in a separate
        # process (subprocess.Popen), exposed through a JSON-RPC
        # interface.
        # There are issues with the GTK gui freezing when the
        # GStreamer pipeline is started here directly.
        from pygst_utils.elements.draw_queue import get_example_draw_queue
        if self.draw_cairo:
            print 'using draw_queue'
            x, y, width, height = self.movie_window.get_allocation()
            draw_queue = get_example_draw_queue(width, height)
        else:
            print 'NOT using draw_queue'
            draw_queue = None
        self._proxy = WindowServiceProxy(port=59000)

        try:
            self._proxy.window_xid(self.movie_view.window_xid)
            device, caps_str = self.get_video_device_and_caps_str()
            self._proxy.create(device, caps_str, record_path=self.output_path,
                    bitrate=self.bitrate, draw_queue=draw_queue, with_warp=True,
                    with_scale=True)
            self._proxy.set_warp_transform(self.transform_str)
            self._proxy.start()
            self._proxy.scale(width, height)
        except (Exception, ), why:
            print why
            self.stop()
            return
Exemple #6
0
 def error_dlg(self, *args, **kw):
     return dialogs.error(parent = self, *args, **kw)
Exemple #7
0
 def die_gui(message, exception=None):
     """Die in a GUI way."""
     error(_('Fatal error, cannot start PIDA'),
           long='%s\n%s' % (message, exception))
     die_cli(message)