コード例 #1
0
	def install_clicked(self,widget):

		try:
			mw=self.core.lri.main_window
			a=_("Do you want to INSTALL this kernel?")
			d=Dialog.QuestionDialog(mw,_("First Aid Kit"),_("%s\n%s"%(a,widget.label)))
			response=d.run()
			d.destroy()
			if response== Gtk.ResponseType.OK:
				self.info_box_stack.set_visible_child_name("info_kernel")
				self.core.dprint('install    %s      %s'%(widget.label,[widget.data[1],widget.data[3]]),"[KernelBox]")
				self.kernel_install('install',widget.label,[widget.data[1],widget.data[3]])			
			else:
				self.info_box_stack.set_visible_child_name("info_kernel")
				a=_("You cancel to install kernel:")
				self.txt_check_kernel.set_name("INFO_LABEL")
				self.txt_check_kernel.set_text(_("%s %s")%(a,widget.label))
				self.core.dprint("%s %s"%(a,widget.label),"[KernelBox]")
				self.update_kernels_button.set_sensitive(True)
				self.filter_kernels_button.set_sensitive(True)
				self.apply_kernel_button.set_sensitive(True)
				self.entry_kernel.set_can_focus(True)
				self.switch_kernel_installed.set_sensitive(True)

		except Exception as e:
			self.core.dprint("(install_clicked) Error: %s"%e,"[KernelBox]")
			self.info_box_stack.set_visible_child_name("info_kernel")
			self.txt_check_kernel.set_name("INFO_LABEL_ERROR")
			self.txt_check_kernel.set_text(_("(install_clicked) Error: %s"%e))
コード例 #2
0
	def delete_package_dialog(self,pkg_name):
		
		main_window=self.core.lri.main_window
		dialog=Dialog.QuestionDialog(main_window,_("Delete package"),_("Do you want to delete '%s'?")%pkg_name)
		response=dialog.run()
		dialog.destroy()
		
		if response== Gtk.ResponseType.OK:
			return True
		
		return False
コード例 #3
0
    def changes_detected_dialog(self):

        dialog = Dialog.QuestionDialog(
            self.main_window, _("Changes detected"),
            _("There are unsaved changes. Do you want to discard them?"))
        response = dialog.run()
        dialog.destroy()

        if response == Gtk.ResponseType.OK:
            return True

        return False
コード例 #4
0
	def error_epi_deb_dialog(self,comment):
		
		main_window=self.core.lri.main_window
		dialog=Dialog.QuestionDialog(main_window,_("Delete package list"),comment)
		response=dialog.run()
		dialog.destroy()
				
		if response== Gtk.ResponseType.OK:
			return True
		
		return False
		
	#def error_epi_deb_dialog
コード例 #5
0
    def delete_update_dialog(self):

        main_window = self.core.lri.main_window
        dialog = Dialog.QuestionDialog(
            main_window, _("Delete Update"),
            _("Do you want to delete scheduled update?"))
        response = dialog.run()
        dialog.destroy()

        if response == Gtk.ResponseType.OK:
            return True

        return False
コード例 #6
0
    def send_file_dialog(self, pkg_name):

        main_window = self.core.lri.main_window
        dialog = Dialog.QuestionDialog(
            main_window, _("DEB not in Server"),
            _("Do you want to send to the server this DEB '%s' ?") % pkg_name)
        response = dialog.run()
        dialog.destroy()

        if response == Gtk.ResponseType.OK:
            return True

        return False
コード例 #7
0
    def send_list_dialog(self, pkg_name_orig):
        main_window = self.core.lri.main_window
        pkg_name = '\n'.join(pkg_name_orig)
        dialog = Dialog.QuestionDialog(
            main_window, _("Executable not in Server"),
            _("Do you want to send to the server this Executable list?\n%s\n")
            % pkg_name)
        response = dialog.run()
        dialog.destroy()

        if response == Gtk.ResponseType.OK:
            return True

        return False
コード例 #8
0
    def remove_file_dialog(self, pkg_name):

        main_window = self.core.lri.main_window
        dialog = Dialog.QuestionDialog(
            main_window, _("Delete package"),
            _("IMPORTANT\nDo you want to delete this Executable from your server?\n'%s'"
              ) % pkg_name)
        response = dialog.run()
        dialog.destroy()

        if response == Gtk.ResponseType.OK:
            return True

        return False
コード例 #9
0
	def changes_detected_dialog(self,force_exit=False):
		
		main_window=self.core.lri.main_window
		
		dialog=Dialog.QuestionDialog(main_window,_("Changes detected"),_("There are unsaved changes. Do you want to discard them?"))
		response=dialog.run()
		dialog.destroy()
		
		if response== Gtk.ResponseType.OK:
			if force_exit:
				sys.exit(0)
				
			return True
		
		return False
コード例 #10
0
    def delete_test_deb_dialog(self, pkg_name_orig):

        main_window = self.core.lri.main_window
        pkg_name = '\n'.join(pkg_name_orig)
        dialog = Dialog.QuestionDialog(
            main_window, _("Delete deb list"),
            _("This DEB list is unavaiable from your server:\n%s\nDo you want delete it?"
              ) % pkg_name)
        response = dialog.run()
        dialog.destroy()

        if response == Gtk.ResponseType.OK:
            return True

        return False
コード例 #11
0
    def delete_test_exec_dialog(self, pkg_list_tupla):

        main_window = self.core.lri.main_window
        lista = []
        for (pkg_name_orig, md5) in pkg_list_tupla:
            lista.append(pkg_name_orig)
        pkg_name = '\n'.join(lista)
        dialog = Dialog.QuestionDialog(
            main_window, _("Delete Executable list"),
            _("This Executable list is unavaiable from your server:\n%s\nDo you want delete it?"
              ) % pkg_name)
        response = dialog.run()
        dialog.destroy()

        if response == Gtk.ResponseType.OK:
            return True

        return False
コード例 #12
0
    def sure_delete(self, thread):

        try:
            if thread.is_alive():
                return True

            self.detect_connected_clients_cancelled = True
            self.spinner.stop()
            self.txt_apply.set_markup(
                "<span foreground='blue'>" +
                _("Finished. Log is found in /var/log/home-eraser.log ") +
                "</span>")

            #Do you want to execute again? or Exit.
            dialog = Dialog.QuestionDialog(
                self.main_window, _(u"HOME ERASER"),
                _(u"Do you want to execute it again?"))
            response = dialog.run()
            dialog.destroy()
            #if response == Gtk.ResponseType.YES:
            if response == Gtk.ResponseType.OK:

                self.apply_button.set_sensitive(True)
                self.checkb1.set_sensitive(True)
                self.checkb2.set_sensitive(True)
                self.checkb3.set_sensitive(True)
                self.checkb4.set_sensitive(True)
                self.checkb5.set_sensitive(True)
                self.checkb6.set_sensitive(True)

            else:
                #Gtk.main_quit()
                #sys.exit(0)
                pass

        except Exception as e:
            self.dprint(e)
            print("[HomeEraserGUI](sure_delete) %s" % e)
            return [False, str(e)]
コード例 #13
0
	def uninstall_clicked(self,widget):

		try:
			#CANCEL OPERATION IF THIS KERNEL IS IN USE AT THE MOMENT OR KERNEL IS IN META LLIUREX
			kernel_file='/tmp/.uname'
			os.system('uname -r > %s'%kernel_file)
			f=open(kernel_file)
			lines=f.readlines()
			f.close()
			os.remove(kernel_file)

			for line in lines:
				if widget.label in line:
					mw=self.core.lri.main_window
					d=Dialog.InfoDialog(mw,_("First Aid Kit"),_("You can't delete this kernel because you are using now."))
					response=d.run()
					d.destroy()
					self.core.dprint("You can't delete this kernel because you are using now: %s"%(widget.label),"[KernelBox]")
					self.update_kernels_button.set_sensitive(True)
					self.filter_kernels_button.set_sensitive(True)
					self.apply_kernel_button.set_sensitive(True)
					self.entry_kernel.set_can_focus(True)
					self.switch_kernel_installed.set_sensitive(True)

					return True

			# CANCEL OPERATION IF LLIUREX-META I AFFECTED WITH THIS OPERATION
			kernel_file='/tmp/.uname'
			os.system('LANG=C apt show linux-headers-generic > %s'%kernel_file)
			f=open(kernel_file)
			lines=f.readlines()
			f.close()
			os.remove(kernel_file)

			for line in lines:
				if 'Depends' in line:
					if widget.label in line:
						mw=self.core.lri.main_window
						a=_("First Aid Kit")
						b=_("You can't delete this kernel because is essential for LliureX.")
						d=Dialog.InfoDialog(mw,a,b)
						response=d.run()
						d.destroy()
						self.core.dprint("You can't delete this kernel because is essential for LliureX: %s"%(widget.label),"[KernelBox]")
						self.update_kernels_button.set_sensitive(True)
						self.filter_kernels_button.set_sensitive(True)
						self.apply_kernel_button.set_sensitive(True)
						self.entry_kernel.set_can_focus(True)
						self.switch_kernel_installed.set_sensitive(True)

						return True



			mw=self.core.lri.main_window
			a = _("First Aid Kit")
			b = _("Do you want to DELETE this kernel?")
			d=Dialog.QuestionDialog(mw,a,("%s\n%s"%(b,widget.label)))


			response=d.run()
			d.destroy()
			if response== Gtk.ResponseType.OK:
				self.info_box_stack.set_visible_child_name("info_kernel")
				self.core.dprint('delete    %s      %s'%(widget.label,[widget.data[1],widget.data[3]]),"[KernelBox]")
				self.kernel_install('delete',widget.label,[widget.data[1],widget.data[3]])				
			else:
				self.info_box_stack.set_visible_child_name("info_kernel")
				a = _("You cancel to uninstall kernel:")
				self.txt_check_kernel.set_name("INFO_LABEL")
				self.txt_check_kernel.set_text(_("%s %s")%(a,widget.label))
				self.core.dprint("You cancel to uninstall kernel: %s"%(widget.label),"[KernelBox]")
				self.update_kernels_button.set_sensitive(True)
				self.filter_kernels_button.set_sensitive(True)
				self.apply_kernel_button.set_sensitive(True)
				self.entry_kernel.set_can_focus(True)
				self.switch_kernel_installed.set_sensitive(True)

		except Exception as e:
			self.core.dprint("(uninstall_clicked) Error: %s"%e,"[KernelBox]")
			self.info_box_stack.set_visible_child_name("info_kernel")
			a=_("(uninstall_clicked) Error:")
			self.txt_check_kernel.set_name("INFO_LABEL_ERROR")
			self.txt_check_kernel.set_text("%s %s"%(a,e))
コード例 #14
0
    def apply_button_clicked(self, widget=True):

        try:

            delete = {}
            delete[self.home] = []
            delete[self.net] = []

            info = {}
            info[self.students] = {}

            info[self.students][self.home] = self.checkb1.get_active()
            if info[self.students][self.home]:
                delete[self.home].append("students")
            info[self.students][self.net] = self.checkb4.get_active()
            if info[self.students][self.net]:
                delete[self.net].append("students")
            info[self.teachers] = {}
            info[self.teachers][self.home] = self.checkb2.get_active()
            if info[self.teachers][self.home]:
                delete[self.home].append("teachers")
            info[self.teachers][self.net] = self.checkb5.get_active()
            if info[self.teachers][self.net]:
                delete[self.net].append("teachers")
            info[self.admins] = {}
            info[self.admins][self.home] = self.checkb3.get_active()
            if info[self.admins][self.home]:
                delete[self.home].append("admins")
            info[self.admins][self.net] = self.checkb6.get_active()
            if info[self.admins][self.net]:
                delete[self.net].append("admins")

            for g in info:
                self.dprint(g)
                for d in info[g]:
                    self.dprint("\t %s : %s" % (d, info[g][d]))

            self.dprint("Summary to remove this elements: %s" % (delete))

            #Are you sure to delete????

            if (len(delete[self.home]) > 0) or (len(delete[self.net]) > 0):

                #dialog = Gtk.MessageDialog(None,0,Gtk.MessageType.WARNING, Gtk.ButtonsType.YES_NO, "HOME ERASER")
                #dialog.format_secondary_text(_("Are you sure you want to delete?"))

                dialog = Dialog.QuestionDialog(
                    self.main_window, _(u"HOME ERASER"),
                    _(u"Are you sure you want to delete?"))
                response = dialog.run()
                dialog.destroy()
                #if response == Gtk.ResponseType.YES:
                if response == Gtk.ResponseType.OK:

                    self.apply_button.set_sensitive(False)
                    self.checkb1.set_sensitive(False)
                    self.checkb2.set_sensitive(False)
                    self.checkb3.set_sensitive(False)
                    self.checkb4.set_sensitive(False)
                    self.checkb5.set_sensitive(False)
                    self.checkb6.set_sensitive(False)
                    self.txt_apply.set_text(_("Working........"))
                    self.apply_delete_methods_thread(delete)
            else:
                #dialog = Gtk.MessageDialog(None,0,Gtk.MessageType.INFO, Gtk.ButtonsType.OK, "HOME ERASER")
                #dialog.format_secondary_text(_("You didn't select any option to delete."))
                dialog = Dialog.InfoDialog(
                    self.main_window, _(u"HOME ERASER"),
                    _(u"You didn't select any option to delete."))
                response = dialog.run()
                dialog.destroy()

        except Exception as e:
            self.dprint(e)
            print("[HomeEraserGUI](apply_button_clicked) %s" % e)
            return [False, str(e)]