def __init_stack__(self):
     self.dbg = False
     self._debug("installer load")
     self.description = (_("Air Apps Installer"))
     self.menu_description = (_("Install air apps"))
     self.icon = ('air-installer')
     self.tooltip = (_(
         "From here you can manage the air apps installed on your system"))
     self.index = 2
     self.enabled = True
     self.level = 'system'
     #		self.hideControlButtons()
     self.airinstaller = installer.AirManager()
     self.setStyleSheet(self._setCss())
Example #2
0
 def __init_stack__(self):
     self.dbg = False
     self._debug("manager load")
     self.description = (_("Air Apps Manager"))
     self.menu_description = (_("Manage air apps"))
     self.icon = ('dialog-password')
     self.tooltip = (_(
         "From here you can manage the air apps installed on your system"))
     self.index = 1
     self.enabled = True
     self.level = 'system'
     self.hideControlButtons()
     self.airinstaller = installer.AirManager()
     self.menu = App2Menu.app2menu()
     self.setStyleSheet(self._setCss())
     self.widget = ''
Example #3
0
    def __init__(self):
        self.dbg = True
        Gtk.ScrolledWindow.__init__(self)
        #		self.override_background_color(Gtk.StateFlags.NORMAL,Gdk.RGBA(255,255,255,1))
        self.grid = Gtk.Grid()
        self.set_css_info()
        self.core = Core.Core.get_core()
        self.airinstaller = installer.AirManager()
        self.listbox = Gtk.ListBox()
        self.listbox.set_selection_mode(Gtk.SelectionMode.NONE)
        layout = Gtk.Layout()
        vadjustment = layout.get_vadjustment()
        vscrollbar = Gtk.Scrollbar(orientation=Gtk.Orientation.VERTICAL,
                                   adjustment=vadjustment)
        #		self.grid.attach(vscrollbar,1,0,1,1)
        self.grid.attach(self.listbox, 0, 1, 1, 1)
        self._load_installed_apps()

        self.check_window = Gtk.Window()
        self.check_window.set_position(Gtk.WindowPosition.CENTER)
        self.check_window.set_decorated(False)
        self.check_window.set_modal(True)
        self.check_window.set_keep_above(True)
        check_box = Gtk.VBox()
        check_label = Gtk.Label("Removing file...")
        check_label.set_margin_top(5)
        check_label.set_margin_bottom(10)
        check_label.set_margin_right(30)
        check_label.set_margin_left(30)
        self.check_pbar = Gtk.ProgressBar()
        self.check_pbar.set_margin_top(5)
        self.check_pbar.set_margin_bottom(10)
        self.check_pbar.set_margin_right(30)
        self.check_pbar.set_margin_left(30)
        check_box.add(check_label)
        check_box.add(self.check_pbar)
        check_label.set_name("MSG_LABEL")
        self.check_window.add(check_box)
        self.add(self.grid)
        GObject.threads_init()
 def _loadAppData(self, air=""):
     if air:
         air_info = installer.AirManager().get_air_info(air)
         pb = air_info.get('pb', '')
         if pb:
             #Convert GDK pixbuf to QPixmap
             img = QtGui.QImage(GdkPixbuf.Pixbuf.get_pixels(pb),
                                GdkPixbuf.Pixbuf.get_width(pb),
                                GdkPixbuf.Pixbuf.get_height(pb),
                                QtGui.QImage.Format_ARGB32
                                )  #,GdkPixbuf.Pixbuf.get_rowstride(pb))
             icon = QtGui.QIcon(QtGui.QPixmap(img))
             self.btn_icon.setIcon(icon)
             self.btn_icon.setIconSize(QSize(64, 64))
         name = air_info.get('name', os.path.basename(self.inp_file.text()))
         self.inp_name.setText(name)
     else:
         self.inp_name.setText("")
         self.inp_desc.setText("")
         icon = QtGui.QIcon.fromTheme("application-x-air-installer")
         self.btn_icon.setIcon(icon)
         self.btn_icon.setIconSize(QSize(64, 64))
         self.frame.setEnabled(False)
Example #5
0
    def on_drag_data_received(self, widget, drag_context, x, y, data, info,
                              time):
        self.drop = True
        text = data.get_text()
        text = text.strip().split("//")

        text[1] = text[1].replace('%20', ' ')
        self._debug("Checking %s" % text[1])
        check = self.commonFunc.check_extension(text[1])

        if check["status"]:
            self.install_label.set_text('')
            Gtk.Image.set_from_file(self, DROP_CORRECT)
            self.install_button.set_sensitive(True)
            self.air_file = text[1]
            if self.info_label:
                self.info_label.set_markup(
                    _("<b>Selected app:</b>\n%s") %
                    os.path.basename(self.air_file))
            air_info = installer.AirManager().get_air_info(self.air_file)
            self.img_icon.set_from_pixbuf(air_info['pb'])
            self.pb = air_info['pb']
            self._debug("File %s" % self.air_file)
        else:
            Gtk.Image.set_from_file(self, DROP_INCORRECT)
            self.install_button.set_sensitive(False)
            self.air_file = ''

        param = {
            'status': check['status'],
            'code': check['code'],
            'file_name': text[1],
            'install_label': self.install_label,
            'install_button': self.install_button
        }
        self.commonFunc.manage_outputinfo(**param)
Example #6
0
 def _filechooser(self, *args):
     dw = Gtk.FileChooserDialog(_("Select air package"), None,
                                Gtk.FileChooserAction.OPEN,
                                (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                                 Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
     dw.set_action(Gtk.FileChooserAction.OPEN)
     file_filter = Gtk.FileFilter()
     file_filter.add_pattern('*.air')
     file_filter.set_name("Air files")
     dw.add_filter(file_filter)
     air_chooser = dw.run()
     if air_chooser == Gtk.ResponseType.OK:
         self.install_label.set_text('')
         self.drop_area.air_file = dw.get_filename()
         self.drop_area.set_from_file(DROP_CORRECT)
         self.install_button.set_sensitive(True)
         self.lbl_drop.set_markup(
             _("<b>Selected app:</b>\n%s") %
             os.path.basename(self.drop_area.air_file))
         air_info = installer.AirManager().get_air_info(
             self.drop_area.air_file)
         self.img_icon.set_from_pixbuf(air_info['pb'])
         self.pb = air_info['pb']
     dw.destroy()
Example #7
0
	def _load_gui(self,air_file):
		air_file_path=os.path.abspath(air_file)
		self._debug("Installing %s (%s)"%(air_file,air_file_path))
		file_name=os.path.basename(air_file)
		Gtk.Window.__init__(self,title=_("Install air app"))
		self.set_position(Gtk.WindowPosition.CENTER)
		style_provider=Gtk.CssProvider()
		css=b"""
		#label #label_install{
			padding: 6px;
			margin:6px;
			font: 12px Roboto;
		}
		#label_install:insensitive{
			padding: 6px;
			margin:6px;
			font: 12px Roboto;
			color:white;
			background-image:-gtk-gradient (linear, left top, left bottom, from (#7ea8f2),to (#7ea8f2));
			box-shadow: -0.5px 3px 2px #aaaaaa;
		}
		#frame{
			padding: 6px;
			margin:6px;
			font: 12px Roboto;
			background:white;
		}
		"""
		style_provider.load_from_data(css)
		Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),style_provider,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
		self.pb=GdkPixbuf.Pixbuf()
		self.box=Gtk.Grid(row_spacing=6,column_spacing=6)
		self.add(self.box)
		img_banner=Gtk.Image()
		img_banner.set_from_file(RSRC+"/air-installer.png")
		self.box.attach(img_banner,0,0,1,1)
		self.pulse=Gtk.Spinner()
		self.box.attach(self.pulse,0,1,2,2)
		
		img_info=Gtk.Image()
		img_info.set_from_stock(Gtk.STOCK_SAVE,Gtk.IconSize.DIALOG)

		self.lbl_info=Gtk.Label('')
		self.lbl_info.set_name('label_install')
		self.lbl_info.set_max_width_chars(20)
		self.lbl_info.set_width_chars(20)
		self.lbl_info.set_line_wrap(True)
		lbl_text=_("Install <b>%s</b>")%file_name
		self.lbl_info.set_markup(lbl_text)
		self.lbl_info.set_margin_bottom(GTK_SPACING)
		self.lbl_info.set_margin_left(GTK_SPACING)
		self.lbl_info.set_margin_right(GTK_SPACING)
		self.lbl_info.set_margin_top(GTK_SPACING)

		self.box_info=Gtk.Box()
		self.box_info.add(self.lbl_info)
		self.box_info.add(img_info)

		self.btn_install=Gtk.Button()
		self.btn_install.add(self.box_info)

		img_icon=Gtk.Image()
		img_icon.set_from_file(RSRC+"/air-installer_icon.png")
		self.pb=img_icon.get_pixbuf()
		air_info=installer.AirManager().get_air_info(air_file_path)
		if 'pb' in air_info.keys():
			if air_info['pb']:
				img_icon.set_from_pixbuf(air_info['pb'])
				self.pb=air_info['pb']

		lbl_text=_("<b>Select icon</b> for %s")%file_name
		lbl_icon=Gtk.Label()
		lbl_icon.set_markup(lbl_text)
		lbl_icon.set_name('label')
		lbl_icon.set_max_width_chars(20)
		lbl_icon.set_width_chars(20)
		lbl_icon.set_line_wrap(True)

		self.box_icon=Gtk.Box(spacing=6)
		self.box_icon.add(lbl_icon)
		self.box_icon.add(img_icon)

		self.btn_icon=Gtk.Button()
		self.btn_icon.add(self.box_icon)

		self.box_button=Gtk.HBox(spacing=6)
		self.box_button.props.halign=Gtk.Align.END
		self.box.set_margin_bottom(GTK_SPACING)
		self.box.set_margin_left(GTK_SPACING)
		self.box.set_margin_top(GTK_SPACING)

		btn_cancel=Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE)

		self.box_button.add(btn_cancel)
		self.box.attach_next_to(self.btn_icon,img_banner,Gtk.PositionType.BOTTOM,1,1)
		self.box.attach_next_to(self.btn_install,self.btn_icon,Gtk.PositionType.BOTTOM,1,1)
		self.box.attach_next_to(self.box_button,self.btn_install,Gtk.PositionType.BOTTOM,1,1)

		self.btn_install.connect("clicked",self._begin_install_file,air_file_path)
		self.btn_icon.connect("clicked",self._set_app_icon,img_icon)
		btn_cancel.connect("clicked",Gtk.main_quit)
		self.connect("destroy",Gtk.main_quit)
		self.show_all()
		Gtk.main()
#!/usr/bin/env python3
import  airmanager.airmanager as installer
import sys
import subprocess
import tempfile
import os

installer=installer.AirManager()
err=0
dbg=True

def _debug(msg):
	if dbg:
		print("Helper: %s"%msg)
#def _debug

if sys.argv[1]=='install':
	airFile=sys.argv[2]
	if (len(sys.argv))==4:
		iconFile=sys.argv[3]
	else:
		air_info=installer.get_air_info(airFile)
		if 'pb' in air_info.keys():
			if air_info['pb']:
				iconFile=tempfile.mkstemp()[1]
				iconFileTmp=air_info['pb']
				iconFileTmp.savev(iconFile,'png',[""],[""])

	_debug("Installing %s %s"%(airFile,iconFile))
	err=installer.install(airFile,iconFile)
	try:
Example #9
0
def _get_air_info(air):
	global retCode
	airInfo={}
	airInfo=installer.AirManager().get_air_info(air)
	return (airInfo)