brand new pamac

This commit is contained in:
guinux 2013-09-26 18:02:07 +02:00
parent 13497e5c7a
commit c7735f173d
20 changed files with 2835 additions and 2846 deletions

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Only root can own the service -->
<policy user="root">
<allow own="org.manjaro.pamac"/>
</policy>
<!-- Allow anyone to invoke methods on the interfaces -->
<policy context="default">
<allow send_destination="org.manjaro.pamac"
send_interface="org.manjaro.pamac"/>
</policy>
</busconfig>

View File

@ -1,5 +0,0 @@
[D-BUS Service]
Name=org.manjaro.pamac
Exec=/usr/bin/pamac-daemon
User=root
SystemdService=pamac.service

View File

@ -6,21 +6,46 @@
<vendor>Manjaro</vendor> <vendor>Manjaro</vendor>
<vendor_url>http://manjaro.org/</vendor_url> <vendor_url>http://manjaro.org/</vendor_url>
<icon_name>package-x-generic</icon_name> <icon_name>package-x-generic</icon_name>
<action id="org.manjaro.pamac.commit"> <action id="org.manjaro.pamac.pkexec.pamac-manager">
<message>Authentication is required</message> <message>Authentication is required</message>
<defaults> <defaults>
<allow_any>no</allow_any> <allow_any>no</allow_any>
<allow_inactive>no</allow_inactive> <allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active> <allow_active>auth_admin_keep</allow_active>
</defaults> </defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/python3</annotate>
<annotate key="org.freedesktop.policykit.exec.argv1">/usr/bin/pamac-manager</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action> </action>
<action id="org.manjaro.pamac.pkexec.pamac-updater">
<action id="org.manjaro.pamac.init_release"> <message>Authentication is required</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/python3</annotate>
<annotate key="org.freedesktop.policykit.exec.argv1">/usr/bin/pamac-updater</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
<action id="org.manjaro.pamac.pkexec.pamac-install">
<message>Authentication is required</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/python3</annotate>
<annotate key="org.freedesktop.policykit.exec.argv1">/usr/bin/pamac-install</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
<action id="org.manjaro.pamac.pkexec.pamac-refresh">
<defaults> <defaults>
<allow_any>no</allow_any> <allow_any>no</allow_any>
<allow_inactive>no</allow_inactive> <allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active> <allow_active>yes</allow_active>
</defaults> </defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/python3</annotate>
<annotate key="org.freedesktop.policykit.exec.argv1">/usr/bin/pamac-refresh</annotate>
</action> </action>
</policyconfig> </policyconfig>

View File

@ -1,7 +0,0 @@
[Unit]
Description=Pamac
[Service]
Type=dbus
BusName=org.manjaro.pamac
ExecStart=/usr/bin/pamac-daemon

View File

@ -1,7 +1,9 @@
./pamac-daemon.py ./pamac-manager.py
./pamac-updater.py
./pamac-tray.py ./pamac-tray.py
./pamac-install.py ./pamac-install.py
./pamac/main.py
./pamac/common.py ./pamac/common.py
./gui/manager.glade ./pamac/transaction.py
./gui/updater.glade ./gui/manager.ui
./gui/updater.ui
./gui/dialogs.ui

View File

@ -1,118 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkMessageDialog" id="ErrorDialog">
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<property name="has_resize_grip">False</property>
<property name="message_type">error</property>
<property name="buttons">ok</property>
<child internal-child="vbox">
<object class="GtkBox" id="messagedialog-vbox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<object class="GtkMessageDialog" id="InfoDialog">
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<property name="buttons">ok</property>
<child internal-child="vbox">
<object class="GtkBox" id="messagedialog-vbox9">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area9">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkMessageDialog" id="QuestionDialog">
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<property name="message_type">question</property>
<property name="buttons">yes-no</property>
<child internal-child="vbox">
<object class="GtkBox" id="messagedialog-vbox8">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area8">
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<object class="GtkMessageDialog" id="WarningDialog">
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<property name="message_type">warning</property>
<property name="buttons">ok</property>
<child internal-child="vbox">
<object class="GtkBox" id="messagedialog-vbox7">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area7">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

528
gui/dialogs.ui Normal file
View File

@ -0,0 +1,528 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkDialog" id="ChooseDialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Choose</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ChooseButton">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ChooseButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="choose_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<property name="min_content_width">300</property>
<property name="min_content_height">250</property>
<child>
<object class="GtkTreeView" id="treeview5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">choose_list</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="enable_search">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection5"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<child>
<object class="GtkCellRendererToggle" id="choose_renderertoggle">
<signal name="toggled" handler="on_choose_renderertoggle_toggled" swapped="no"/>
</object>
<attributes>
<attribute name="active">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="choose_renderertext"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">ChooseButton</action-widget>
</action-widgets>
</object>
<object class="GtkWindow" id="ConfDialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Summary</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<child>
<object class="GtkBox" id="box7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="sum_top_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<property name="min_content_width">330</property>
<property name="min_content_height">250</property>
<child>
<object class="GtkTreeView" id="treeview4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">transaction_sum</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="enable_search">False</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="_action">
<child>
<object class="GtkCellRendererText" id="cellrenderertext5">
<property name="yalign">0</property>
<property name="weight">600</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="_packages">
<child>
<object class="GtkCellRendererText" id="cellrenderertext6"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="sum_bottom_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">7</property>
<property name="homogeneous">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="TransCancelButton">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="is_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_TransCancelButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="TransValidButton">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_TransValidButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkMessageDialog" id="ErrorDialog">
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<property name="has_resize_grip">False</property>
<property name="message_type">error</property>
<property name="buttons">ok</property>
<child internal-child="vbox">
<object class="GtkBox" id="messagedialog-vbox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<object class="GtkMessageDialog" id="InfoDialog">
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<property name="buttons">ok</property>
<child internal-child="vbox">
<object class="GtkBox" id="messagedialog-vbox9">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area9">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkWindow" id="ProgressWindow">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Progress</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="default_width">450</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<property name="has_resize_grip">False</property>
<child>
<object class="GtkBox" id="box8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkBox" id="box9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkImage" id="action_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="progresslabel2">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkProgressBar" id="progressbar2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pulse_step">0.050000000000000003</property>
<property name="show_text">True</property>
<property name="ellipsize">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkExpander" id="progress_expander">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="resize_toplevel">True</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow11">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="window_placement">bottom-left</property>
<property name="window_placement_set">True</property>
<property name="shadow_type">in</property>
<property name="min_content_height">200</property>
<child>
<object class="GtkTextView" id="progress_textview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="wrap_mode">word</property>
<property name="cursor_visible">False</property>
<signal name="size-allocate" handler="on_progress_textview_size_allocate" swapped="no"/>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">details</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ProgressCancelButton">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ProgressCancelButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ProgressCloseButton">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ProgressCloseButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkMessageDialog" id="QuestionDialog">
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<property name="message_type">question</property>
<property name="buttons">yes-no</property>
<child internal-child="vbox">
<object class="GtkBox" id="messagedialog-vbox8">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area8">
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<object class="GtkMessageDialog" id="WarningDialog">
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<property name="message_type">warning</property>
<property name="buttons">ok</property>
<child internal-child="vbox">
<object class="GtkBox" id="messagedialog-vbox7">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area7">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<object class="GtkListStore" id="choose_list">
<columns>
<!-- column-name gboolean1 -->
<column type="gboolean"/>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="transaction_sum">
<columns>
<!-- column-name action -->
<column type="gchararray"/>
<!-- column-name packages -->
<column type="gchararray"/>
</columns>
</object>
</interface>

View File

@ -1,38 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<!-- interface-requires gtk+ 3.0 --> <!-- interface-requires gtk+ 3.6 -->
<object class="GtkDialog" id="ChooseDialog"> <object class="GtkAboutDialog" id="AboutDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="title" translatable="yes">Choose</property> <property name="border_width">5</property>
<property name="modal">True</property> <property name="title" translatable="yes">About Pamac</property>
<property name="window_position">center-on-parent</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<property name="deletable">False</property> <property name="program_name">Pamac</property>
<property name="transient_for">ManagerWindow</property> <property name="copyright" translatable="yes">Copyright © 2013 Guillaume Benoit</property>
<property name="comments" translatable="yes">A gtk3 frontend for pyalpm</property>
<property name="website">http://manjaro.org</property>
<property name="logo_icon_name">system-software-install</property>
<property name="license_type">gpl-3-0</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="aboutdialog-vbox1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area"> <child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1"> <object class="GtkButtonBox" id="aboutdialog-action_area1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="layout_style">end</property> <property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ChooseButton">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ChooseButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -42,205 +30,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="choose_label"> <placeholder/>
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<property name="min_content_width">300</property>
<property name="min_content_height">250</property>
<child>
<object class="GtkTreeView" id="treeview5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">choose_list</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="enable_search">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection5"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<child>
<object class="GtkCellRendererToggle" id="cellrenderertoggle2">
<signal name="toggled" handler="on_cellrenderertoggle2_toggled" swapped="no"/>
</object>
<attributes>
<attribute name="active">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderertext7"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">ChooseButton</action-widget>
</action-widgets>
</object>
<object class="GtkWindow" id="ConfDialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Summary</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<property name="transient_for">ManagerWindow</property>
<child>
<object class="GtkBox" id="box7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="sum_top_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<property name="min_content_width">330</property>
<property name="min_content_height">250</property>
<child>
<object class="GtkTreeView" id="treeview4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">transaction_sum</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="enable_search">False</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="_action">
<child>
<object class="GtkCellRendererText" id="cellrenderertext5">
<property name="yalign">0</property>
<property name="weight">600</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="_packages">
<child>
<object class="GtkCellRendererText" id="cellrenderertext6"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="sum_bottom_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">7</property>
<property name="homogeneous">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="TransCancelButton">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="is_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_TransCancelButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="TransValidButton">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_TransValidButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child> </child>
</object> </object>
</child> </child>
@ -259,6 +49,68 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="manager_valid_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">valid_icon</property>
<property name="relief">none</property>
<property name="focus_on_click">False</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="on_manager_valid_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="manager_cancel_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">cancel_icon</property>
<property name="relief">none</property>
<property name="focus_on_click">False</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="on_manager_cancel_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="menu_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="image">menu_icon</property>
<property name="relief">none</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child> <child>
<object class="GtkPaned" id="paned1"> <object class="GtkPaned" id="paned1">
<property name="visible">True</property> <property name="visible">True</property>
@ -395,17 +247,17 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="margin_top">2</property> <property name="margin_top">2</property>
<child> <child>
<object class="GtkTreeView" id="state_treeview"> <object class="GtkTreeView" id="states_treeview">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="model">state_list</property> <property name="model">states_list</property>
<property name="headers_visible">False</property> <property name="headers_visible">False</property>
<property name="headers_clickable">False</property> <property name="headers_clickable">False</property>
<property name="enable_search">False</property> <property name="enable_search">False</property>
<property name="show_expanders">False</property> <property name="show_expanders">False</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection" id="state_treeview_selection"> <object class="GtkTreeSelection" id="states_treeview_selection">
<signal name="changed" handler="on_state_treeview_selection_changed" swapped="no"/> <signal name="changed" handler="on_states_treeview_selection_changed" swapped="no"/>
</object> </object>
</child> </child>
<child> <child>
@ -502,14 +354,13 @@
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="shadow_type">in</property> <property name="shadow_type">in</property>
<child> <child>
<object class="GtkTreeView" id="list_treeview"> <object class="GtkTreeView" id="packages_list_treeview">
<property name="width_request">500</property> <property name="width_request">500</property>
<property name="height_request">300</property> <property name="height_request">300</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="model">packages_list</property>
<property name="search_column">0</property> <property name="search_column">0</property>
<signal name="button-press-event" handler="on_list_treeview_button_press_event" swapped="no"/> <signal name="button-press-event" handler="on_list_treeview_button_press_event" swapped="no"/>
<signal name="row-activated" handler="on_list_treeview_row_activated" swapped="no"/> <signal name="row-activated" handler="on_list_treeview_row_activated" swapped="no"/>
@ -519,64 +370,54 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn" id="installed_column"> <object class="GtkTreeViewColumn" id="state_column">
<property name="resizable">True</property> <property name="resizable">True</property>
<property name="sizing">autosize</property>
<property name="title" translatable="yes">State</property> <property name="title" translatable="yes">State</property>
<property name="clickable">True</property> <property name="clickable">True</property>
<property name="sort_indicator">True</property> <property name="sort_column_id">0</property>
<property name="sort_column_id">1</property> <signal name="clicked" handler="on_state_column_clicked" swapped="no"/>
<child> <child>
<object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1"/> <object class="GtkCellRendererPixbuf" id="state_rendererpixbuf"/>
<attributes>
<attribute name="pixbuf">2</attribute>
</attributes>
</child> </child>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn" id="name_column"> <object class="GtkTreeViewColumn" id="name_column">
<property name="resizable">True</property> <property name="resizable">True</property>
<property name="sizing">autosize</property>
<property name="title" translatable="yes">Name</property> <property name="title" translatable="yes">Name</property>
<property name="clickable">True</property> <property name="clickable">True</property>
<property name="sort_indicator">True</property>
<property name="sort_column_id">0</property> <property name="sort_column_id">0</property>
<signal name="clicked" handler="on_name_column_clicked" swapped="no"/>
<child> <child>
<object class="GtkCellRendererText" id="cellrenderertext3"> <object class="GtkCellRendererText" id="name_renderertext"/>
<property name="xalign">0</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child> </child>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn" id="version_column"> <object class="GtkTreeViewColumn" id="version_column">
<property name="resizable">True</property> <property name="resizable">True</property>
<property name="sizing">autosize</property>
<property name="title" translatable="yes">Version</property> <property name="title" translatable="yes">Version</property>
<property name="clickable">True</property> <property name="clickable">True</property>
<property name="sort_indicator">True</property> <property name="sort_column_id">0</property>
<property name="sort_column_id">7</property> <signal name="clicked" handler="on_version_column_clicked" swapped="no"/>
<child> <child>
<object class="GtkCellRendererText" id="cellrenderertext15"/> <object class="GtkCellRendererText" id="version_renderertext"/>
<attributes>
<attribute name="text">5</attribute>
</attributes>
</child> </child>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn" id="size_column"> <object class="GtkTreeViewColumn" id="size_column">
<property name="resizable">True</property> <property name="resizable">True</property>
<property name="sizing">autosize</property>
<property name="title" translatable="yes">Size</property> <property name="title" translatable="yes">Size</property>
<property name="clickable">True</property> <property name="clickable">True</property>
<property name="sort_indicator">True</property> <property name="sort_column_id">0</property>
<property name="sort_column_id">6</property> <signal name="clicked" handler="on_size_column_clicked" swapped="no"/>
<child> <child>
<object class="GtkCellRendererText" id="cellrenderertext11"/> <object class="GtkCellRendererText" id="size_renderertext"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child> </child>
</object> </object>
</child> </child>
@ -865,131 +706,41 @@
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="padding">5</property> <property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkButtonBox" id="buttonbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<property name="homogeneous">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ManagerRefreshButton">
<property name="label">gtk-refresh</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_Manager_RefreshButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ManagerValidButton">
<property name="label">gtk-apply</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_Manager_ValidButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ManagerEraseButton">
<property name="label">gtk-undo</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_Manager_EraseButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ManagerQuitButton">
<property name="label">gtk-quit</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_Manager_QuitButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">4</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>
</child> </child>
</object> </object>
<object class="GtkWindow" id="ProgressWindow"> <object class="GtkFileChooserDialog" id="PackagesChooserDialog">
<property name="width_request">250</property>
<property name="height_request">60</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">5</property> <property name="border_width">5</property>
<property name="title" translatable="yes">Progress</property> <property name="title" translatable="yes">Install local packages</property>
<property name="resizable">False</property> <property name="role">GtkFileChooserDialog</property>
<property name="modal">True</property> <property name="modal">True</property>
<property name="window_position">center-on-parent</property> <property name="window_position">center-on-parent</property>
<property name="default_width">250</property>
<property name="default_height">60</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<property name="deletable">False</property> <property name="create_folders">False</property>
<property name="transient_for">ManagerWindow</property> <property name="filter">package_filter</property>
<property name="has_resize_grip">False</property> <property name="select_multiple">True</property>
<child> <signal name="file-activated" handler="on_PackagesChooserDialog_file_activated" swapped="no"/>
<object class="GtkBox" id="box8"> <child internal-child="vbox">
<property name="visible">True</property> <object class="GtkBox" id="filechooserdialog-vbox1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">5</property> <property name="spacing">2</property>
<child> <child internal-child="action_area">
<object class="GtkBox" id="box9"> <object class="GtkButtonBox" id="filechooserdialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="spacing">5</property> <property name="layout_style">end</property>
<child> <child>
<object class="GtkImage" id="action_icon"> <object class="GtkButton" id="package_cancel_button">
<property name="label">gtk-cancel</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_package_cancel_button_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -998,9 +749,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="progresslabel2"> <object class="GtkButton" id="package_open_button">
<property name="label">gtk-open</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_package_open_button_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -1012,60 +767,24 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkProgressBar" id="progressbar2"> <placeholder/>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pulse_step">0.050000000000000003</property>
<property name="show_text">True</property>
<property name="ellipsize">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ProgressCancelButton">
<property name="label">gtk-cancel</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="xalign">1</property>
<signal name="clicked" handler="on_ProgressCancelButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child> </child>
</object> </object>
</child> </child>
<action-widgets>
<action-widget response="0">package_cancel_button</action-widget>
<action-widget response="0">package_open_button</action-widget>
</action-widgets>
</object> </object>
<object class="GtkListStore" id="choose_list"> <object class="GtkImage" id="cancel_icon">
<columns> <property name="visible">True</property>
<!-- column-name gboolean1 --> <property name="can_focus">False</property>
<column type="gboolean"/> <property name="stock">gtk-cancel</property>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
</columns>
</object> </object>
<object class="GtkListStore" id="deps_list"> <object class="GtkListStore" id="deps_list">
<columns> <columns>
@ -1101,18 +820,78 @@
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkImage" id="local_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixel_size">16</property>
<property name="icon_name">emblem-package</property>
</object>
<object class="GtkMenu" id="main_menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="refresh_item">
<property name="label">gtk-refresh</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_refresh_item_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem1">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="local_item">
<property name="label">Install local packages</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="image">local_icon</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_local_item_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem2">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="about_item">
<property name="label">gtk-about</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_about_item_activate" swapped="no"/>
</object>
</child>
</object>
<object class="GtkImage" id="menu_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-execute</property>
</object>
<object class="GtkFileFilter" id="package_filter">
<mime-types>
<mime-type>application/x-xz-compressed-tar</mime-type>
</mime-types>
</object>
<object class="GtkListStore" id="packages_list"> <object class="GtkListStore" id="packages_list">
<columns> <columns>
<!-- column-name name --> <!-- column-name name -->
<column type="gchararray"/> <column type="gchararray"/>
<!-- column-name installed --> <!-- column-name installed -->
<column type="gboolean"/> <column type="gboolean"/>
<!-- column-name icon -->
<column type="GdkPixbuf"/>
<!-- column-name size_string --> <!-- column-name size_string -->
<column type="gchararray"/> <column type="gchararray"/>
<!-- column-name real_size --> <!-- column-name real_size -->
<column type="gint"/> <column type="gdouble"/>
<!-- column-name version --> <!-- column-name version -->
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
@ -1129,18 +908,15 @@
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkListStore" id="state_list"> <object class="GtkListStore" id="states_list">
<columns> <columns>
<!-- column-name state --> <!-- column-name state -->
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkListStore" id="transaction_sum"> <object class="GtkImage" id="valid_icon">
<columns> <property name="visible">True</property>
<!-- column-name action --> <property name="can_focus">False</property>
<column type="gchararray"/> <property name="stock">gtk-ok</property>
<!-- column-name packages -->
<column type="gchararray"/>
</columns>
</object> </object>
</interface> </interface>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<!-- interface-requires gtk+ 3.0 --> <!-- interface-requires gtk+ 3.6 -->
<object class="GtkWindow" id="UpdaterWindow"> <object class="GtkWindow" id="UpdaterWindow">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">5</property> <property name="border_width">5</property>
@ -21,7 +21,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child> <child>
<object class="GtkImage" id="image1"> <object class="GtkImage" id="updater_image">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="pixel_size">48</property> <property name="pixel_size">48</property>
@ -87,21 +87,6 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="UpdaterQuitButton">
<property name="label">gtk-quit</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_Updater_QuitButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>

View File

@ -1,488 +0,0 @@
#! /usr/bin/python3
# -*- coding:utf-8 -*-
import dbus
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GObject
import pyalpm
from multiprocessing import Process
from pamac import config, common
# i18n
import gettext
gettext.bindtextdomain('pamac', '/usr/share/locale')
gettext.textdomain('pamac')
_ = gettext.gettext
class PamacDBusService(dbus.service.Object):
def __init__(self):
bus=dbus.SystemBus()
bus_name = dbus.service.BusName('org.manjaro.pamac', bus)
dbus.service.Object.__init__(self, bus_name, '/org/manjaro/pamac')
self.t = None
self.task = None
self.error = ''
self.warning = ''
self.previous_action = ''
self.action = _('Preparing')+'...'
self.previous_icon = ''
self.icon = '/usr/share/pamac/icons/24x24/status/package-setup.png'
self.previous_target = ''
self.target = ''
self.previous_percent = 0
self.percent = 0
self.total_size = 0
self.already_transferred = 0
self.handle = config.handle()
def get_handle(self):
print('daemon get handle')
self.handle = config.handle()
self.handle.dlcb = self.cb_dl
self.handle.totaldlcb = self.totaldlcb
self.handle.eventcb = self.cb_event
self.handle.questioncb = self.cb_conv
self.handle.progresscb = self.cb_progress
self.handle.logcb = self.cb_log
@dbus.service.signal('org.manjaro.pamac')
def EmitAction(self, action):
pass
@dbus.service.signal('org.manjaro.pamac')
def EmitIcon(self, icon):
pass
@dbus.service.signal('org.manjaro.pamac')
def EmitTarget(self, target):
pass
@dbus.service.signal('org.manjaro.pamac')
def EmitPercent(self, percent):
pass
def cb_event(self, ID, event, tupel):
if ID is 1:
self.action = _('Checking dependencies')+'...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif ID is 2:
if self.warning:
self.EmitLogWarning(self.warning)
self.warning = ''
elif ID is 3:
self.action = _('Checking file conflicts')+'...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif ID is 5:
self.action = _('Resolving dependencies')+'...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-setup.png'
elif ID is 6:
if self.warning:
self.EmitLogWarning(self.warning)
self.warning = ''
elif ID is 7:
self.action = _('Checking inter conflicts')+'...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif ID is 9:
self.action = _('Installing')+'...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-add.png'
elif ID is 10:
formatted_event = 'Installed {pkgname} ({pkgversion})'.format(pkgname = tupel[0].name, pkgversion = tupel[0].version)
common.write_log_file(formatted_event)
print(formatted_event)
elif ID is 11:
self.action = _('Removing')+'...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-delete.png'
elif ID is 12:
formatted_event = 'Removed {pkgname} ({pkgversion})'.format(pkgname = tupel[0].name, pkgversion = tupel[0].version)
common.write_log_file(formatted_event)
print(formatted_event)
elif ID is 13:
self.action = _('Upgrading')+'...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-update.png'
elif ID is 14:
formatted_event = 'Upgraded {pkgname} ({oldversion} -> {newversion})'.format(pkgname = tupel[1].name, oldversion = tupel[1].version, newversion = tupel[0].version)
common.write_log_file(formatted_event)
print(formatted_event)
elif ID is 15:
self.action = _('Downgrading')+'...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-add.png'
print('Downgrading a package')
#elif ID is 16:
#formatted_event = 'Downgraded {pkgname} ({oldversion} -> {newversion})'.format(pkgname = tupel[1].name, oldversion = tupel[1].version, newversion = tupel[0].version)
#common.write_log_file(formatted_event)
#print(formatted_event)
elif ID is 17:
self.action = _('Reinstalling')+'...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-add.png'
print('Reinstalling a package')
#elif ID is 18:
#formatted_event = 'Reinstalled {pkgname} ({pkgversion})'.format(pkgname = tupel[0].name, pkgversion = tupel[0].version)
#common.write_log_file(formatted_event)
#print(formatted_event)
elif ID is 19:
self.action = _('Checking integrity')+'...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
self.already_transferred = 0
elif ID is 21:
self.action = _('Loading packages files')+'...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
print('Loading packages files')
elif ID is 30:
self.action = _('Configuring')+'...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-setup.png'
self.EmitPercent(2)
print('Configuring a package')
elif ID is 31:
print('Downloading a file')
elif ID is 36:
self.action = _('Checking keys in keyring')+'...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
print('Checking keys in keyring')
else :
self.action = ''
#self.EmitTarget('')
#self.EmitPercent(0)
if self.action != self.previous_action:
self.previous_action = self.action
self.EmitAction(self.action)
if self.icon != self.previous_icon:
self.previous_icon = self.icon
self.EmitIcon(self.icon)
print(ID,event)
def cb_conv(self, *args):
print("conversation", args)
def cb_log(self, level, line):
_logmask = pyalpm.LOG_ERROR | pyalpm.LOG_WARNING
if not (level & _logmask):
return
if level & pyalpm.LOG_ERROR:
#self.error += "ERROR: "+line
#self.EmitLogError(line)
print(line)
elif level & pyalpm.LOG_WARNING:
self.warning += "WARNING: "+line
#self.EmitLogWarning(line)
elif level & pyalpm.LOG_DEBUG:
line = "DEBUG: " + line
print(line)
elif level & pyalpm.LOG_FUNCTION:
line = "FUNC: " + line
print(line)
@dbus.service.signal('org.manjaro.pamac')
def EmitLogError(self, message):
pass
@dbus.service.signal('org.manjaro.pamac')
def EmitLogWarning(self, message):
pass
def totaldlcb(self, _total_size):
self.total_size = _total_size
def cb_dl(self, _target, _transferred, total):
if self.total_size > 0:
fraction = (_transferred+self.already_transferred)/self.total_size
size = 0
try:
if (self.t.to_remove or self.t.to_add):
for pkg in self.t.to_remove+self.t.to_add:
if pkg.filename == _target:
size = pkg.size
if _transferred == size:
self.already_transferred += size
self.action = _('Downloading {size}').format(size = common.format_size(self.total_size))
self.target = _target
self.percent = round(fraction, 2)
self.icon = '/usr/share/pamac/icons/24x24/status/package-download.png'
else:
self.action = _('Refreshing')+'...'
self.target = _target
self.percent = 2
self.icon = '/usr/share/pamac/icons/24x24/status/refresh-cache.png'
if self.action != self.previous_action:
self.previous_action = self.action
self.EmitAction(self.action)
if self.icon != self.previous_icon:
self.previous_icon = self.icon
self.EmitIcon(self.icon)
if self.target != self.previous_target:
self.previous_target = self.target
self.EmitTarget(self.target)
if self.percent != self.previous_percent:
self.previous_percent = self.percent
self.EmitPercent(self.percent)
except pyalpm.error:
pass
def cb_progress(self, _target, _percent, n, i):
self.target = _target+' ('+str(i)+'/'+str(n)+')'
#self.percent = round(_percent/100, 2)
self.percent = round(i/n, 2)
if self.target != self.previous_target:
self.previous_target = self.target
self.EmitTarget(self.target)
if self.percent != self.previous_percent:
self.previous_percent = self.percent
self.EmitPercent(self.percent)
def policykit_test(self, sender, connexion, action):
bus = dbus.SystemBus()
proxy_dbus = connexion.get_object('org.freedesktop.DBus','/org/freedesktop/DBus/Bus', False)
dbus_info = dbus.Interface(proxy_dbus,'org.freedesktop.DBus')
sender_pid = dbus_info.GetConnectionUnixProcessID(sender)
proxy_policykit = bus.get_object('org.freedesktop.PolicyKit1','/org/freedesktop/PolicyKit1/Authority',False)
policykit_authority = dbus.Interface(proxy_policykit,'org.freedesktop.PolicyKit1.Authority')
Subject = ('unix-process', {'pid': dbus.UInt32(sender_pid, variant_level=1),
'start-time': dbus.UInt64(0, variant_level=1)})
(is_authorized,is_challenge,details) = policykit_authority.CheckAuthorization(Subject, action, {'': ''}, dbus.UInt32(1), '')
return is_authorized
@dbus.service.signal('org.manjaro.pamac')
def EmitAvailableUpdates(self, updates_nb):
pass
def CheckUpdates(self):
updates = 0
_ignorepkgs = []
for group in self.handle.ignoregrps:
db = self.handle.get_localdb()
grp = db.read_grp(group)
if grp:
name, pkg_list = grp
for pkg in pkg_list:
if not pkg.name in _ignorepkgs:
_ignorepkgs.append(pkg.name)
for name in self.handle.ignorepkgs:
pkg = self.handle.get_localdb().get_pkg(name)
if pkg:
if not pkg.name in _ignorepkgs:
_ignorepkgs.append(pkg.name)
if config.syncfirst:
for name in config.syncfirst:
pkg = self.handle.get_localdb().get_pkg(name)
if pkg:
candidate = pyalpm.sync_newversion(pkg, self.handle.get_syncdbs())
if candidate:
updates += 1
if not updates:
for pkg in self.handle.get_localdb().pkgcache:
candidate = pyalpm.sync_newversion(pkg, self.handle.get_syncdbs())
if candidate:
if not candidate.name in _ignorepkgs:
updates += 1
self.EmitAvailableUpdates(updates)
@dbus.service.method('org.manjaro.pamac', '', 's', async_callbacks=('success', 'nosuccess'))
def Refresh(self, success, nosuccess):
def refresh():
self.target = ''
self.percent = 0
self.error = ''
self.get_handle()
for db in self.handle.get_syncdbs():
try:
self.t = self.handle.init_transaction()
db.update(force = False)
except pyalpm.error as e:
self.error += ' --> '+str(e)+'\n'
break
finally:
try:
self.t.release()
except:
pass
if self.error:
self.EmitTransactionError(self.error)
else:
self.CheckUpdates()
self.EmitTransactionDone('')
self.task = Process(target=refresh)
self.task.start()
success('')
@dbus.service.method('org.manjaro.pamac', 'a{sb}', 's')#, sender_keyword='sender', connection_keyword='connexion')
def Init(self, options):#, sender=None, connexion=None):
self.error = ''
#if self.policykit_test(sender,connexion,'org.manjaro.pamac.init_release'):
try:
self.get_handle()
self.t = self.handle.init_transaction(**options)
print('Init:',self.t.flags)
except pyalpm.error as e:
self.error += ' --> '+str(e)+'\n'
finally:
if self.error:
self.EmitTransactionError(self.error)
return self.error
#else:
# return _('Authentication failed')
@dbus.service.method('org.manjaro.pamac', '', 's')
def Sysupgrade(self):
self.error = ''
try:
self.t.sysupgrade(downgrade=False)
print('to_upgrade:',self.t.to_add)
except pyalpm.error as e:
self.error += ' --> '+str(e)+'\n'
finally:
return self.error
@dbus.service.method('org.manjaro.pamac', 's', 's')
def Remove(self, pkgname):
self.error = ''
try:
pkg = self.handle.get_localdb().get_pkg(pkgname)
if pkg is not None:
self.t.remove_pkg(pkg)
except pyalpm.error as e:
self.error += ' --> '+str(e)+'\n'
finally:
return self.error
@dbus.service.method('org.manjaro.pamac', 's', 's')
def Add(self, pkgname):
self.error = ''
try:
for repo in self.handle.get_syncdbs():
pkg = repo.get_pkg(pkgname)
if pkg:
self.t.add_pkg(pkg)
break
except pyalpm.error as e:
self.error += ' --> '+str(e)+'\n'
finally:
return self.error
@dbus.service.method('org.manjaro.pamac', 's', 's')
def Load(self, tarball_path):
self.error = ''
try:
pkg = self.handle.load_pkg(tarball_path)
if pkg:
self.t.add_pkg(pkg)
except pyalpm.error:
self.error += _('{pkgname} is not a valid path or package name').format(pkgname = tarball_path)
finally:
return self.error
@dbus.service.method('org.manjaro.pamac', '', 's')
def Prepare(self):
self.error = ''
try:
self.t.prepare()
except pyalpm.error as e:
self.error += ' --> '+str(e)+'\n'
finally:
return self.error
@dbus.service.method('org.manjaro.pamac', '', 'a(ss)')
def To_Remove(self):
liste = []
for pkg in self.t.to_remove:
liste.append((pkg.name, pkg.version))
return liste
@dbus.service.method('org.manjaro.pamac', '', 'a(ssi)')
def To_Add(self):
liste = []
for pkg in self.t.to_add:
liste.append((pkg.name, pkg.version, pkg.download_size))
return liste
@dbus.service.method('org.manjaro.pamac', '', 's', async_callbacks=('success', 'nosuccess'))
def Interrupt(self, success, nosuccess):
def interrupt():
self.error = ''
#try:
# self.t.interrupt()
#except pyalpm.error as e:
# self.error += ' --> '+str(e)+'\n'
try:
self.t.release()
#except pyalpm.error as e:
#self.error += ' --> '+str(e)+'\n'
except:
pass
#finally:
#if self.error:
#self.EmitTransactionError(self.error)
self.task.terminate()
interrupt()
success('')
@dbus.service.method('org.manjaro.pamac', '', 's', sender_keyword='sender', connection_keyword='connexion', async_callbacks=('success', 'nosuccess'))
def Commit(self, success, nosuccess, sender=None, connexion=None):
def commit():
self.error = ''
try:
self.t.commit()
except pyalpm.error as e:
self.error += ' --> '+str(e)+'\n'
#except dbus.exceptions.DBusException:
#pass
finally:
self.CheckUpdates()
if self.warning:
self.EmitLogWarning(self.warning)
self.warning = ''
if self.error:
self.EmitTransactionError(self.error)
else:
self.EmitTransactionDone(_('Transaction successfully finished'))
try:
authorized = self.policykit_test(sender,connexion,'org.manjaro.pamac.commit')
except dbus.exceptions.DBusException as e:
self.EmitTransactionError(_('Authentication failed'))
success('')
else:
if authorized:
self.task = Process(target=commit)
self.task.start()
else :
self.t.release()
self.EmitTransactionError(_('Authentication failed'))
success('')
@dbus.service.signal('org.manjaro.pamac')
def EmitTransactionDone(self, message):
pass
@dbus.service.signal('org.manjaro.pamac')
def EmitTransactionError(self, message):
pass
@dbus.service.method('org.manjaro.pamac', '', 's')#, sender_keyword='sender', connection_keyword='connexion')
def Release(self):#, sender=None, connexion=None):
self.error = ''
#if self.policykit_test(sender,connexion,'org.manjaro.pamac.init_release'):
try:
self.t.release()
except pyalpm.error as e:
self.error += ' --> '+str(e)+'\n'
finally:
return self.error
#else :
# return _('Authentication failed')
@dbus.service.method('org.manjaro.pamac')
def StopDaemon(self):
try:
self.t.release()
except:
pass
common.rm_pid_file()
mainloop.quit()
GObject.threads_init()
DBusGMainLoop(set_as_default = True)
myservice = PamacDBusService()
common.write_pid_file()
mainloop = GObject.MainLoop()
mainloop.run()

144
pamac-install.py Executable file → Normal file
View File

@ -1,11 +1,10 @@
#! /usr/bin/python3 #! /usr/bin/pkexec /usr/bin/python3
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
from gi.repository import GObject from gi.repository import Gtk
from sys import argv from sys import argv
import dbus
from os.path import abspath from os.path import abspath
from pamac import common from pamac import common, transaction
# i18n # i18n
import gettext import gettext
@ -16,97 +15,84 @@ gettext.textdomain('pamac')
_ = gettext.gettext _ = gettext.gettext
def exiting(msg): def exiting(msg):
transaction.StopDaemon()
print('exiting') print('exiting')
loop.quit() loop.quit()
def new_on_TransCancelButton_clicked(self, *arg): def on_ProgressCloseButton_clicked(*args):
main.ProgressWindow.hide() transaction.ProgressWindow.hide()
main.ConfDialog.hide() transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter())
transaction.Release() common.rm_pid_file()
exiting('') Gtk.main_quit()
def new_on_TransValidButton_clicked(self, *arg): def on_ProgressCancelButton_clicked(*args):
main.ConfDialog.hide() trans.interrupt()
main.finalize()
def get_pkgs(pkgs): def on_TransCancelButton_clicked(self, *arg):
transaction.ConfDialog.hide()
trans.release()
common.rm_pid_file()
Gtk.main_quit()
def on_TransValidButton_clicked(self, *arg):
transaction.ConfDialog.hide()
trans.finalize()
common.rm_pid_file()
Gtk.main_quit()
def get_pkgs(pkgstr_list):
get_error = '' get_error = ''
for pkg in pkgs: for pkgstr in pkgstr_list:
if '.pkg.tar.' in pkg: if '.pkg.tar.' in pkgstr:
full_path = abspath(pkg) full_path = abspath(pkgstr)
transaction.to_load.add(full_path) trans.to_load.append(full_path)
elif pkg in transaction.syncpkgs.keys():
transaction.to_add.add(pkg)
else: else:
if get_error: pkg = trans.get_syncpkg(pkgstr)
get_error += '\n' if pkg:
get_error += _('{pkgname} is not a valid path or package name').format(pkgname = pkg) trans.to_add.append(pkg)
else:
if get_error:
get_error += '\n'
get_error += _('{pkgname} is not a valid path or package name').format(pkgname = pkgstr)
if get_error: if get_error:
main.handle_error(get_error) trans.handle_error(get_error)
exiting(get_error)
return False return False
else: else:
return True return True
def install(pkgs): signals = {'on_TransValidButton_clicked' : on_TransValidButton_clicked,
if get_pkgs(pkgs): 'on_TransCancelButton_clicked' : on_TransCancelButton_clicked,
main.check_conflicts() 'on_ChooseButton_clicked' : transaction.on_ChooseButton_clicked,
if transaction.to_add | transaction.to_load: 'on_progress_textview_size_allocate' : transaction.on_progress_textview_size_allocate,
if transaction.init_transaction(noconflicts = True): 'on_choose_renderertoggle_toggled' : transaction.on_choose_renderertoggle_toggled,
for pkgname in transaction.to_add: 'on_ProgressCancelButton_clicked' : on_ProgressCancelButton_clicked,
transaction.Add(pkgname) 'on_ProgressCloseButton_clicked' : on_ProgressCloseButton_clicked}
for pkg_path in transaction.to_load:
transaction.Load(pkg_path)
for pkgname in transaction.to_remove:
transaction.Remove(pkgname)
_error = transaction.Prepare()
if _error:
main.handle_error(_error)
exiting(_error)
else:
main.set_transaction_sum()
if len(main.transaction_sum) != 0:
main.ConfDialog.show_all()
loop.run()
else:
main.WarningDialog.format_secondary_text(_('Nothing to do'))
response = main.WarningDialog.run()
if response:
main.WarningDialog.hide()
exiting('')
else:
main.WarningDialog.format_secondary_text(_('Nothing to do'))
response = main.WarningDialog.run()
if response:
main.WarningDialog.hide()
exiting('')
if common.pid_file_exists(): if common.pid_file_exists():
from pamac.main import ErrorDialog transaction.ErrorDialog.format_secondary_text(_('Pamac is already running'))
ErrorDialog.format_secondary_text(_('Pamac is already running')) response = transaction.ErrorDialog.run()
response = ErrorDialog.run()
if response: if response:
ErrorDialog.hide() transaction.ErrorDialog.hide()
else: else:
from pamac import transaction, main trans = transaction.Transaction()
transaction.get_handle() do_syncfirst, updates = trans.get_updates()
transaction.update_db()
do_syncfirst, updates = transaction.get_updates()
if updates: if updates:
main.ErrorDialog.format_secondary_text(_('Some updates are available.\nPlease update your system first')) transaction.ErrorDialog.format_secondary_text(_('Some updates are available.\nPlease update your system first'))
response = main.ErrorDialog.run() response = transaction.ErrorDialog.run()
if response: if response:
main.ErrorDialog.hide() transaction.ErrorDialog.hide()
transaction.StopDaemon()
else: else:
loop = GObject.MainLoop() transaction.interface.connect_signals(signals)
main.config_signals() args_str = argv[1:]
bus = dbus.SystemBus() if get_pkgs(args_str):
bus.add_signal_receiver(exiting, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionDone") if trans.to_add or trans.to_load:
bus.add_signal_receiver(exiting, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionError") if trans.init(cascade = True):
main.Handler.on_TransCancelButton_clicked = new_on_TransCancelButton_clicked for pkg in trans.to_add:
main.Handler.on_TransValidButton_clicked = new_on_TransValidButton_clicked trans.add(pkg)
main.interface.connect_signals(main.Handler()) for path in trans.to_load:
pkgs_to_install = argv[1:] trans.load(path)
install(pkgs_to_install) if trans.prepare():
common.write_pid_file()
trans.set_transaction_sum(True)
transaction.ConfDialog.show()
Gtk.main()

718
pamac-manager.py Executable file → Normal file
View File

@ -1,6 +1,718 @@
#! /usr/bin/python3 #! /usr/bin/pkexec /usr/bin/python3
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
from pamac import main version = '0.8.0'
main.main('manager') from gi.repository import Gtk, Gdk
from gi.repository.GdkPixbuf import Pixbuf
import pyalpm
from time import strftime, localtime
from pamac import config, common, transaction
# i18n
import gettext
import locale
locale.bindtextdomain('pamac', '/usr/share/locale')
gettext.bindtextdomain('pamac', '/usr/share/locale')
gettext.textdomain('pamac')
_ = gettext.gettext
interface = transaction.interface
interface.add_from_file('/usr/share/pamac/gui/manager.ui')
ManagerWindow = interface.get_object("ManagerWindow")
details_list = interface.get_object('details_list')
deps_list = interface.get_object('deps_list')
files_list = interface.get_object('files_list')
files_scrolledwindow = interface.get_object('files_scrolledwindow')
name_label = interface.get_object('name_label')
desc_label = interface.get_object('desc_label')
link_label = interface.get_object('link_label')
licenses_label = interface.get_object('licenses_label')
search_entry = interface.get_object('search_entry')
search_list = interface.get_object('search_list')
search_selection = interface.get_object('search_treeview_selection')
packages_list_treeview = interface.get_object('packages_list_treeview')
state_column = interface.get_object('state_column')
name_column = interface.get_object('name_column')
version_column = interface.get_object('version_column')
size_column = interface.get_object('size_column')
state_rendererpixbuf = interface.get_object('state_rendererpixbuf')
name_renderertext = interface.get_object('name_renderertext')
version_renderertext = interface.get_object('version_renderertext')
size_renderertext = interface.get_object('size_renderertext')
list_selection = interface.get_object('list_treeview_selection')
groups_list = interface.get_object('groups_list')
groups_selection = interface.get_object('groups_treeview_selection')
states_list = interface.get_object('states_list')
states_selection = interface.get_object('states_treeview_selection')
repos_list = interface.get_object('repos_list')
repos_selection = interface.get_object('repos_treeview_selection')
AboutDialog = interface.get_object('AboutDialog')
menu_button = interface.get_object('menu_button')
main_menu = interface.get_object('main_menu')
PackagesChooserDialog = interface.get_object('PackagesChooserDialog')
AboutDialog.set_version(version)
menu_button.set_popup(main_menu)
search_dict = {}
groups_dict = {}
states_dict = {}
repos_dict = {}
current_filter = (None, None)
right_click_menu = Gtk.Menu()
installed_icon = Pixbuf.new_from_file('/usr/share/pamac/icons/16x16/actions/package-installed-updated.png')
uninstalled_icon = Pixbuf.new_from_file('/usr/share/pamac/icons/16x16/actions/package-available.png')
to_install_icon = Pixbuf.new_from_file('/usr/share/pamac/icons/16x16/actions/package-install.png')
to_reinstall_icon = Pixbuf.new_from_file('/usr/share/pamac/icons/16x16/actions/package-reinstall.png')
to_remove_icon = Pixbuf.new_from_file('/usr/share/pamac/icons/16x16/actions/package-remove.png')
locked_icon = Pixbuf.new_from_file('/usr/share/pamac/icons/16x16/actions/package-installed-locked.png')
def state_column_display_func(column, cell, treemodel, treeiter, data):
if treemodel[treeiter][0] == _('No package found'):
pixbuf = None
elif treemodel[treeiter][0].name in config.holdpkg:
pixbuf = locked_icon
elif treemodel[treeiter][0].db.name == 'local':
if transaction.pkg_in_list(treemodel[treeiter][0], trans.to_add):
pixbuf = to_reinstall_icon
elif transaction.pkg_in_list(treemodel[treeiter][0], trans.to_remove):
pixbuf = to_remove_icon
else:
pixbuf = installed_icon
elif transaction.pkg_in_list(treemodel[treeiter][0], trans.to_add):
pixbuf = to_install_icon
else:
pixbuf = uninstalled_icon
cell.set_property("pixbuf", pixbuf)
def state_column_sort_func(treemodel, treeiter1, treeiter2, data):
if treemodel[treeiter1][0].db.name == 'local':
num1 = 1
else:
num1 = 0
if treemodel[treeiter2][0].db.name == 'local':
num2 = 1
else:
num2 = 0
return num2 - num1
def name_column_display_func(column, cell, treemodel, treeiter, data):
if treemodel[treeiter][0] == _('No package found'):
cell.set_property("text", _('No package found'))
else:
cell.set_property("text", treemodel[treeiter][0].name)
def name_column_sort_func(treemodel, treeiter1, treeiter2, data):
str1 = treemodel[treeiter1][0].name
str2 = treemodel[treeiter2][0].name
if str1 < str2:
return -1
elif str1 > str2:
return 1
else:
return 0
def version_column_display_func(column, cell, treemodel, treeiter, data):
if treemodel[treeiter][0] == _('No package found'):
cell.set_property("text", '')
else:
cell.set_property("text", treemodel[treeiter][0].version)
def version_column_sort_func(treemodel, treeiter1, treeiter2, data):
return pyalpm.vercmp(treemodel[treeiter1][0].version, treemodel[treeiter2][0].version)
def size_column_display_func(column, cell, treemodel, treeiter, data):
if treemodel[treeiter][0] == _('No package found'):
cell.set_property("text", '')
else:
cell.set_property("text", common.format_size(treemodel[treeiter][0].isize))
def size_column_sort_func(treemodel, treeiter1, treeiter2, data):
num1 = treemodel[treeiter1][0].isize
num2 = treemodel[treeiter2][0].isize
return num1 - num2
state_column.set_cell_data_func(state_rendererpixbuf, state_column_display_func)
name_column.set_cell_data_func(name_renderertext, name_column_display_func)
version_column.set_cell_data_func(version_renderertext, version_column_display_func)
size_column.set_cell_data_func(size_renderertext, size_column_display_func)
def update_lists():
for db in trans.handle.get_syncdbs():
for name, pkgs in db.grpcache:
groups_list.append([name])
groups_list.set_sort_column_id(0, Gtk.SortType.ASCENDING)
states = [_('Installed'), _('Uninstalled'), _('Orphans'), _('To install'), _('To remove')]
for state in states:
states_list.append([state])
for db in trans.syncdbs:
repos_list.append([db.name])
repos_list.append([_('local')])
def get_group_list(group):
global groups_dict
if group in groups_dict.keys():
return groups_dict[group]
else:
groups_dict[group] = Gtk.ListStore(object)
dbs_list = [trans.localdb]
dbs_list.extend(trans.syncdbs.copy())
pkgs = pyalpm.find_grp_pkgs(dbs_list, group)
for pkg in pkgs:
groups_dict[group].append([pkg])
return groups_dict[group]
def get_state_list(state):
global states_dict
if state == _('To install'):
liststore = Gtk.ListStore(object)
for pkg in trans.to_add:
liststore.append([pkg])
return liststore
elif state == _('To remove'):
liststore = Gtk.ListStore(object)
for pkg in trans.to_remove:
liststore.append([pkg])
return liststore
elif state in states_dict.keys():
return states_dict[state]
else:
states_dict[state] = Gtk.ListStore(object)
if state == _('Installed'):
for pkg in trans.localdb.pkgcache:
states_dict[state].append([pkg])
elif state == _('Uninstalled'):
for pkg in get_uninstalled_pkgs():
states_dict[state].append([pkg])
elif state == _('Orphans'):
for pkg in get_orphan_pkgs():
states_dict[state].append([pkg])
return states_dict[state]
def get_repo_list(repo):
global repos_dict
if repo in repos_dict.keys():
return repos_dict[repo]
else:
repos_dict[repo] = Gtk.ListStore(object)
if repo == _('local'):
for pkg in trans.localdb.pkgcache:
if not trans.get_syncpkg(pkg.name):
repos_dict[repo].append([pkg])
else:
for db in trans.syncdbs:
if db.name ==repo:
for pkg in db.pkgcache:
local_pkg = trans.get_localpkg(pkg.name)
if local_pkg:
repos_dict[repo].append([local_pkg])
else:
repos_dict[repo].append([pkg])
return repos_dict[repo]
def search_pkgs(search_string):
global search_dict
if search_string in search_dict.keys():
return search_dict[search_string]
else:
search_dict[search_string] = Gtk.ListStore(object)
names_list = []
for pkg in trans.localdb.search(*search_string.split()):
if not pkg.name in names_list:
names_list.append(pkg.name)
search_dict[search_string].append([pkg])
for db in trans.syncdbs:
for pkg in db.search(*search_string.split()):
if not pkg.name in names_list:
names_list.append(pkg.name)
search_dict[search_string].append([pkg])
if not names_list:
search_dict[search_string].append([_('No package found')])
else:
if not search_string in [row[0] for row in search_list]:
search_list.append([search_string])
return search_dict[search_string]
def get_uninstalled_pkgs():
pkgs_list = []
names_list = []
for repo in trans.syncdbs:
for pkg in repo.pkgcache:
if not pkg.name in names_list:
names_list.append(pkg.name)
if not trans.get_localpkg(pkg.name):
pkgs_list.append(pkg)
return pkgs_list
def get_orphan_pkgs():
pkgs_list = []
for pkg in trans.localdb.pkgcache:
if pkg.reason == pyalpm.PKG_REASON_DEPEND:
if not pkg.compute_requiredby():
pkgs_list.append(pkg)
return pkgs_list
def refresh_packages_list(liststore):
#~ packages_list_treeview.freeze_child_notify()
#~ packages_list_treeview.set_model(None)
liststore.set_sort_func(0, name_column_sort_func, None)
liststore.set_sort_column_id(0, Gtk.SortType.ASCENDING)
packages_list_treeview.set_model(liststore)
state_column.set_sort_indicator(False)
name_column.set_sort_indicator(True)
version_column.set_sort_indicator(False)
size_column.set_sort_indicator(False)
#~ packages_list_treeview.thaw_child_notify()
ManagerWindow.get_window().set_cursor(None)
def set_infos_list(pkg):
name_label.set_markup('<big><b>{} {}</b></big>'.format(pkg.name, pkg.version))
# fix &,-,>,< in desc
desc = pkg.desc.replace('&', '&amp;')
desc = desc.replace('<->', '/')
desc_label.set_markup(desc)
# fix & in url
url = pkg.url.replace('&', '&amp;')
link_label.set_markup('<a href=\"{_url}\">{_url}</a>'.format(_url = url))
licenses_label.set_markup(_('Licenses')+': {}'.format(' '.join(pkg.licenses)))
def set_deps_list(pkg, style):
deps_list.clear()
if pkg.depends:
deps_list.append([_('Depends On')+':', '\n'.join(pkg.depends)])
if pkg.optdepends:
optdeps = []
for optdep in pkg.optdepends:
if trans.get_localpkg(optdep.split(':')[0]):
optdeps.append(optdep+' ['+_('Installed')+']')
else:
optdeps.append(optdep)
deps_list.append([_('Optional Deps')+':', '\n'.join(optdeps)])
if style == 'local':
if pkg.compute_requiredby():
deps_list.append([_('Required By')+':', '\n'.join(pkg.compute_requiredby())])
if pkg.provides:
deps_list.append([_('Provides')+':', '\n'.join(pkg.provides)])
if pkg.replaces:
deps_list.append([_('Replaces')+':', '\n'.join(pkg.replaces)])
if pkg.conflicts:
deps_list.append([_('Conflicts With')+':', '\n'.join(pkg.conflicts)])
def set_details_list(pkg, style):
details_list.clear()
if style == 'sync':
details_list.append([_('Repository')+':', pkg.db.name])
if pkg.groups:
details_list.append([_('Groups')+':', ' '.join(pkg.groups)])
if style == 'sync':
details_list.append([_('Compressed Size')+':', common.format_size(pkg.size)])
details_list.append([_('Download Size')+':', common.format_size(pkg.download_size)])
if style == 'local':
details_list.append([_('Installed Size')+':', common.format_size(pkg.isize)])
details_list.append([_('Packager')+':', pkg.packager])
details_list.append([_('Architecture')+':', pkg.arch])
#details_list.append([_('Build Date')+':', strftime("%a %d %b %Y %X %Z", localtime(pkg.builddate))])
if style == 'local':
details_list.append([_('Install Date')+':', strftime("%a %d %b %Y %X %Z", localtime(pkg.installdate))])
if pkg.reason == pyalpm.PKG_REASON_EXPLICIT:
reason = _('Explicitly installed')
elif pkg.reason == pyalpm.PKG_REASON_DEPEND:
reason = _('Installed as a dependency for another package')
else:
reason = _('Unknown')
details_list.append([_('Install Reason')+':', reason])
if style == 'sync':
#details_list.append([_('Install Script')':', 'Yes' if pkg.has_scriptlet else 'No'])
#details_list.append(['MD5 Sum:', pkg.md5sum])
#details_list.append(['SHA256 Sum:', pkg.sha256sum])
details_list.append([_('Signatures')+':', 'Yes' if pkg.base64_sig else 'No'])
if style == 'local':
if len(pkg.backup) != 0:
#details_list.append(['_(Backup files)+':', '\n'.join(["%s %s" % (md5, file) for (file, md5) in pkg.backup])])
details_list.append([_('Backup files')+':', '\n'.join(["%s" % (file) for (file, md5) in pkg.backup])])
def set_files_list(pkg):
files_list.clear()
if len(pkg.files) != 0:
for file in pkg.files:
files_list.append(['/'+file[0]])
def on_ManagerWindow_delete_event(*args):
Gtk.main_quit()
common.rm_pid_file()
def on_TransValidButton_clicked(*args):
global search_dict
global groups_dict
global states_dict
global repos_dict
transaction.ConfDialog.hide()
trans.finalize()
trans.update_dbs()
search_dict = {}
groups_dict = {}
states_dict = {}
repos_dict = {}
if current_filter[0]:
refresh_packages_list(current_filter[0](current_filter[1]))
def on_TransCancelButton_clicked(*args):
transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter())
transaction.ConfDialog.hide()
trans.release()
if current_filter[0]:
refresh_packages_list(current_filter[0](current_filter[1]))
def on_ProgressCloseButton_clicked(*args):
transaction.ProgressWindow.hide()
transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter())
trans.do_sysupgrade(True)
def on_ProgressCancelButton_clicked(*args):
trans.interrupt()
def on_search_entry_icon_press(*args):
on_search_entry_activate(None)
def on_search_entry_activate(widget):
global current_filter
current_filter = (search_pkgs, search_entry.get_text())
refresh_packages_list(search_pkgs(search_entry.get_text()))
def mark_to_install(widget, pkg):
trans.to_add.append(pkg)
def mark_to_reinstall(widget, pkg):
trans.to_add.append(pkg)
def mark_to_remove(widget, pkg):
trans.to_remove.append(pkg)
def mark_to_unselect(widget, pkg):
if pkg.db.name == 'local':
if trans.pkg_in_list(pkg, trans.to_add):
transaction.remove_pkg_from_list(pkg, trans.to_add)
elif transaction.pkg_in_list(pkg, trans.to_remove):
transaction.remove_pkg_from_list(pkg, trans.to_remove)
else:
if transaction.pkg_in_list(pkg, trans.to_add):
transaction.remove_pkg_from_list(pkg, trans.to_add)
def select_optdeps(widget, pkg, optdeps):
transaction.choose_only_one = False
transaction.choose_label.set_markup(_('<b>{pkgname} has {number} uninstalled optional deps.\nPlease choose the one(s) you want to install:</b>').format(pkgname = pkg.name, number = str(len(optdeps))))
transaction.choose_list.clear()
transaction.choose_renderertoggle.set_radio(False)
for long_string in optdeps:
transaction.choose_list.append([False, long_string])
transaction.ChooseDialog.run()
for long_string in trans.to_provide:
trans.to_add.append(trans.get_syncpkg(long_string.split(':')[0]))
def install_with_optdeps(widget, pkg, optdeps):
select_optdeps(widget, pkg, optdeps)
trans.to_add.append(pkg)
def on_list_treeview_button_press_event(treeview, event):
global right_click_menu
liststore = packages_list_treeview.get_model()
# Check if right mouse button was clicked
if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3:
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending():
Gtk.main_iteration()
treepath, viewcolumn, x, y = treeview.get_path_at_pos(int(event.x), int(event.y))
treeiter = liststore.get_iter(treepath)
if treeiter:
if liststore[treeiter][0] != _('No package found') and not liststore[treeiter][0].name in config.holdpkg:
right_click_menu = Gtk.Menu()
if transaction.pkg_in_list(liststore[treeiter][0], trans.to_remove) or transaction.pkg_in_list(liststore[treeiter][0], trans.to_add):
item = Gtk.ImageMenuItem(_('Unselect'))
item.set_image(Gtk.Image.new_from_stock('gtk-undo', Gtk.IconSize.MENU))
item.set_always_show_image(True)
item.connect('activate', mark_to_unselect, liststore[treeiter][0])
right_click_menu.append(item)
elif liststore[treeiter][0].db.name == 'local':
item = Gtk.ImageMenuItem(_('Remove'))
item.set_image(Gtk.Image.new_from_pixbuf(to_remove_icon))
item.set_always_show_image(True)
item.connect('activate', mark_to_remove, liststore[treeiter][0])
right_click_menu.append(item)
item = Gtk.ImageMenuItem(_('Reinstall'))
item.set_image(Gtk.Image.new_from_pixbuf(to_reinstall_icon))
item.set_always_show_image(True)
item.connect('activate', mark_to_reinstall, liststore[treeiter][0])
right_click_menu.append(item)
optdeps_strings = liststore[treeiter][0].optdepends
if optdeps_strings:
available_optdeps = []
for optdep_string in optdeps_strings:
optdep = optdep_string.split(':')[0]
if not trans.get_localpkg(optdep):
available_optdeps.append(optdep_string)
if available_optdeps:
item = Gtk.ImageMenuItem(_('Install optional deps'))
item.set_image(Gtk.Image.new_from_pixbuf(to_install_icon))
item.set_always_show_image(True)
item.connect('activate', select_optdeps, liststore[treeiter][0], available_optdeps)
right_click_menu.append(item)
else:
item = Gtk.ImageMenuItem(_('Install'))
item.set_image(Gtk.Image.new_from_pixbuf(to_install_icon))
item.set_always_show_image(True)
item.connect('activate', mark_to_install, liststore[treeiter][0])
right_click_menu.append(item)
optdeps_strings = liststore[treeiter][0].optdepends
if optdeps_strings:
available_optdeps = []
for optdep_string in optdeps_strings:
optdep = optdep_string.split(':')[0]
if not trans.get_localpkg(optdep):
available_optdeps.append(optdep_string)
if available_optdeps:
item = Gtk.ImageMenuItem(_('Install with optional deps'))
item.set_image(Gtk.Image.new_from_pixbuf(to_install_icon))
item.set_always_show_image(True)
item.connect('activate', install_with_optdeps, liststore[treeiter][0], available_optdeps)
right_click_menu.append(item)
treeview.grab_focus()
treeview.set_cursor(treepath, viewcolumn, 0)
ManagerWindow.get_window().set_cursor(None)
right_click_menu.show_all()
right_click_menu.popup(None, None, None, None, event.button, event.time)
return True
def on_list_treeview_selection_changed(treeview):
liststore, treeiter = list_selection.get_selected()
if treeiter:
if liststore[treeiter][0] != _('No package found'):
set_infos_list(liststore[treeiter][0])
if liststore[treeiter][0].db.name == 'local':
set_deps_list(liststore[treeiter][0], "local")
set_details_list(liststore[treeiter][0], "local")
set_files_list(liststore[treeiter][0])
files_scrolledwindow.set_visible(True)
else:
set_deps_list(liststore[treeiter][0], "sync")
set_details_list(liststore[treeiter][0], "sync")
files_scrolledwindow.set_visible(False)
def on_search_treeview_selection_changed(widget):
global current_filter
while Gtk.events_pending():
Gtk.main_iteration()
liste, line = search_selection.get_selected()
if line:
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending():
Gtk.main_iteration()
current_filter = (search_pkgs, search_list[line][0])
refresh_packages_list(search_pkgs(search_list[line][0]))
def on_groups_treeview_selection_changed(widget):
global current_filter
while Gtk.events_pending():
Gtk.main_iteration()
liste, line = groups_selection.get_selected()
if line:
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending():
Gtk.main_iteration()
current_filter = (get_group_list, groups_list[line][0])
refresh_packages_list(get_group_list(groups_list[line][0]))
def on_states_treeview_selection_changed(widget):
global current_filter
while Gtk.events_pending():
Gtk.main_iteration()
liste, line = states_selection.get_selected()
if line:
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending():
Gtk.main_iteration()
current_filter = (get_state_list, states_list[line][0])
refresh_packages_list(get_state_list(states_list[line][0]))
def on_repos_treeview_selection_changed(widget):
global current_filter
while Gtk.events_pending():
Gtk.main_iteration()
liste, line = repos_selection.get_selected()
if line:
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending():
Gtk.main_iteration()
current_filter = (get_repo_list, repos_list[line][0])
refresh_packages_list(get_repo_list(repos_list[line][0]))
def on_list_treeview_row_activated(treeview, treeiter, column):
liststore = treeview.get_model()
if not liststore[treeiter][0] == _('No package found'):
if not liststore[treeiter][0].name in config.holdpkg:
if liststore[treeiter][0].db.name == 'local':
if transaction.pkg_in_list(liststore[treeiter][0], trans.to_add):
transaction.remove_pkg_from_list(liststore[treeiter][0], trans.to_add)
elif transaction.pkg_in_list(liststore[treeiter][0], trans.to_remove):
transaction.remove_pkg_from_list(liststore[treeiter][0], trans.to_remove)
else:
trans.to_remove.append(liststore[treeiter][0])
else:
if transaction.pkg_in_list(liststore[treeiter][0], trans.to_add):
transaction.remove_pkg_from_list(liststore[treeiter][0], trans.to_add)
else:
trans.to_add.append(liststore[treeiter][0])
while Gtk.events_pending():
Gtk.main_iteration()
def on_notebook1_switch_page(notebook, page, page_num):
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending():
Gtk.main_iteration()
if page_num == 0:
liste, line = search_selection.get_selected()
if line:
on_search_treeview_selection_changed(None)
elif search_entry.get_text():
on_search_entry_activate(None)
elif page_num == 1:
on_groups_treeview_selection_changed(None)
elif page_num == 2:
on_states_treeview_selection_changed(None)
elif page_num == 3:
on_repos_treeview_selection_changed(None)
def on_manager_valid_button_clicked(*args):
trans.run()
def on_manager_cancel_button_clicked(*args):
trans.to_add.clear()
trans.to_remove.clear()
if current_filter[0]:
refresh_packages_list(current_filter[0](current_filter[1]))
def on_refresh_item_activate(*args):
global search_dict
global groups_dict
global states_dict
global repos_dict
trans.refresh(False)
transaction.ProgressWindow.hide()
search_dict = {}
groups_dict = {}
states_dict = {}
repos_dict = {}
if current_filter[0]:
refresh_packages_list(current_filter[0](current_filter[1]))
trans.do_sysupgrade(True)
def on_local_item_activate(*args):
response = PackagesChooserDialog.run()
if response:
PackagesChooserDialog.hide()
def on_about_item_activate(*args):
response = AboutDialog.run()
if response:
AboutDialog.hide()
def on_package_open_button_clicked(*args):
packages_paths = PackagesChooserDialog.get_filenames()
print(packages_paths)
if packages_paths:
PackagesChooserDialog.hide()
for path in packages_paths:
trans.to_load.append(path)
trans.run()
def on_PackagesChooserDialog_file_activated(*args):
on_package_open_button_clicked(*args)
def on_package_cancel_button_clicked(*args):
PackagesChooserDialog.hide()
def on_state_column_clicked(column):
liststore = packages_list_treeview.get_model()
state_column.set_sort_indicator(True)
name_column.set_sort_indicator(False)
version_column.set_sort_indicator(False)
size_column.set_sort_indicator(False)
liststore.set_sort_func(0, state_column_sort_func, None)
def on_name_column_clicked(column):
liststore = packages_list_treeview.get_model()
state_column.set_sort_indicator(False)
name_column.set_sort_indicator(True)
version_column.set_sort_indicator(False)
size_column.set_sort_indicator(False)
liststore.set_sort_func(0, name_column_sort_func, None)
def on_version_column_clicked(column):
liststore = packages_list_treeview.get_model()
state_column.set_sort_indicator(False)
name_column.set_sort_indicator(False)
version_column.set_sort_indicator(True)
size_column.set_sort_indicator(False)
liststore.set_sort_func(0, version_column_sort_func, None)
def on_size_column_clicked(column):
liststore = packages_list_treeview.get_model()
state_column.set_sort_indicator(False)
name_column.set_sort_indicator(False)
version_column.set_sort_indicator(False)
size_column.set_sort_indicator(True)
liststore.set_sort_func(0, size_column_sort_func, None)
signals = {'on_ManagerWindow_delete_event' : on_ManagerWindow_delete_event,
'on_TransValidButton_clicked' : on_TransValidButton_clicked,
'on_TransCancelButton_clicked' : on_TransCancelButton_clicked,
'on_ChooseButton_clicked' : transaction.on_ChooseButton_clicked,
'on_progress_textview_size_allocate' : transaction.on_progress_textview_size_allocate,
'on_choose_renderertoggle_toggled' : transaction.on_choose_renderertoggle_toggled,
'on_ProgressCancelButton_clicked' : on_ProgressCancelButton_clicked,
'on_ProgressCloseButton_clicked' : on_ProgressCloseButton_clicked,
'on_search_entry_icon_press' : on_search_entry_icon_press,
'on_search_entry_activate' : on_search_entry_activate,
'on_list_treeview_button_press_event' : on_list_treeview_button_press_event,
'on_list_treeview_selection_changed' : on_list_treeview_selection_changed,
'on_search_treeview_selection_changed' : on_search_treeview_selection_changed,
'on_groups_treeview_selection_changed' : on_groups_treeview_selection_changed,
'on_states_treeview_selection_changed' : on_states_treeview_selection_changed,
'on_repos_treeview_selection_changed' : on_repos_treeview_selection_changed,
'on_list_treeview_row_activated' : on_list_treeview_row_activated,
'on_notebook1_switch_page' : on_notebook1_switch_page,
'on_manager_valid_button_clicked' : on_manager_valid_button_clicked,
'on_manager_cancel_button_clicked' : on_manager_cancel_button_clicked,
'on_refresh_item_activate' : on_refresh_item_activate,
'on_local_item_activate' : on_local_item_activate,
'on_about_item_activate' : on_about_item_activate,
'on_package_open_button_clicked' : on_package_open_button_clicked,
'on_package_cancel_button_clicked' : on_package_cancel_button_clicked,
'on_PackagesChooserDialog_file_activated' : on_PackagesChooserDialog_file_activated,
'on_state_column_clicked' : on_state_column_clicked,
'on_name_column_clicked' : on_name_column_clicked,
'on_version_column_clicked' : on_version_column_clicked,
'on_size_column_clicked' : on_size_column_clicked}
if common.pid_file_exists():
transaction.ErrorDialog.format_secondary_text(_('Pamac is already running'))
response = transaction.ErrorDialog.run()
if response:
transaction.ErrorDialog.hide()
else:
common.write_pid_file()
interface.connect_signals(signals)
ManagerWindow.show_all()
trans = transaction.Transaction()
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending():
Gtk.main_iteration()
trans.refresh(False)
update_lists()
trans.do_sysupgrade(True)
ManagerWindow.get_window().set_cursor(None)
Gtk.main()

45
pamac-refresh.py Executable file → Normal file
View File

@ -1,31 +1,22 @@
#! /usr/bin/python3 #! /usr/bin/pkexec /usr/bin/python3
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
from gi.repository import GObject from pamac import common, config
from pamac import common
import dbus
def reply(reply):
transaction.StopDaemon()
print('check updates done')
loop.quit()
def error(error):
transaction.StopDaemon()
print('check updates failed')
loop.quit()
loop = GObject.MainLoop()
if not common.pid_file_exists(): if not common.pid_file_exists():
print('checking updates') print('refreshing')
from pamac import transaction handle = config.handle()
bus = dbus.SystemBus() for db in handle.get_syncdbs():
bus.add_signal_receiver(reply, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionDone") try:
bus.add_signal_receiver(error, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionError") t = handle.init_transaction()
try: db.update(force = False)
transaction.Refresh() t.release()
except: except:
pass try:
else: t.release()
loop.run() except:
pass
print('refreshing {} failed'.format(db.name))
break
else:
print('refreshing {} succeeded'.format(db.name))

80
pamac-tray.py Executable file → Normal file
View File

@ -2,11 +2,12 @@
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
from gi.repository import Gtk, GObject from gi.repository import Gtk, GObject
from subprocess import Popen from subprocess import call
import dbus
import threading
from pamac import common
from time import sleep from time import sleep
import threading
from pamac import common, transaction
GObject.threads_init()
# i18n # i18n
import gettext import gettext
@ -14,8 +15,6 @@ gettext.bindtextdomain('pamac', '/usr/share/locale')
gettext.textdomain('pamac') gettext.textdomain('pamac')
_ = gettext.gettext _ = gettext.gettext
GObject.threads_init()
update_icon = '/usr/share/pamac/icons/24x24/status/pamac-update.png' update_icon = '/usr/share/pamac/icons/24x24/status/pamac-update.png'
update_info = _('{number} available updates') update_info = _('{number} available updates')
one_update_info = _('1 available update') one_update_info = _('1 available update')
@ -27,6 +26,7 @@ info = noupdate_info
class Tray: class Tray:
def __init__(self): def __init__(self):
self.statusIcon = Gtk.StatusIcon() self.statusIcon = Gtk.StatusIcon()
self.statusIcon.set_visible(True)
self.menu = Gtk.Menu() self.menu = Gtk.Menu()
self.menuItem = Gtk.ImageMenuItem(_('Update Manager')) self.menuItem = Gtk.ImageMenuItem(_('Update Manager'))
@ -46,13 +46,14 @@ class Tray:
self.statusIcon.connect('activate', self.activate_cb) self.statusIcon.connect('activate', self.activate_cb)
def execute_update(self, widget, event, data = None): def execute_update(self, widget, event, data = None):
Popen(['/usr/bin/pamac-updater']) call(['/usr/bin/pamac-updater'])
def execute_manager(self, widget, event, data = None): def execute_manager(self, widget, event, data = None):
Popen(['/usr/bin/pamac-manager']) call(['/usr/bin/pamac-manager'])
def quit_tray(self, widget, data = None): def quit_tray(self, widget, data = None):
t.shutdown() t1.shutdown()
t2.shutdown()
Gtk.main_quit() Gtk.main_quit()
def popup_menu_cb(self, widget, button, time, data = None): def popup_menu_cb(self, widget, button, time, data = None):
@ -63,16 +64,16 @@ class Tray:
def activate_cb(self, widget, data = None): def activate_cb(self, widget, data = None):
if icon == update_icon: if icon == update_icon:
Popen(['/usr/bin/pamac-updater']) call(['/usr/bin/pamac-updater'])
def update_icon(self, icon, info): def update_icon(self, icon, info):
self.statusIcon.set_from_file(icon) GObject.idle_add(self.statusIcon.set_from_file, icon)
self.statusIcon.set_tooltip_markup(info) GObject.idle_add(self.statusIcon.set_tooltip_markup, info)
def set_visible(self, boolean): def set_visible(self, boolean):
self.statusIcon.set_visible(boolean) self.statusIcon.set_visible(boolean)
class PeriodicTask(threading.Thread): class PeriodicRefresh(threading.Thread):
"""Thread that executes a task every N seconds""" """Thread that executes a task every N seconds"""
def __init__(self): def __init__(self):
threading.Thread.__init__(self) threading.Thread.__init__(self)
@ -88,15 +89,41 @@ class PeriodicTask(threading.Thread):
self._finished.set() self._finished.set()
def run(self): def run(self):
while 1: while True:
if self._finished.isSet(): if self._finished.isSet():
return return
self.task() call(['/usr/bin/pamac-refresh'])
# sleep for interval or until shutdown
self._finished.wait(self._interval) self._finished.wait(self._interval)
def task(self): class PeriodicCheck(threading.Thread):
Popen(['/usr/bin/pamac-refresh']) """Thread that executes a task every N seconds"""
def __init__(self):
threading.Thread.__init__(self)
self._finished = threading.Event()
self._interval = 1
self.trans = transaction.Transaction()
def setInterval(self, interval):
"""Set the number of seconds we sleep between executing our task"""
self._interval = interval
def shutdown(self):
"""Stop this thread"""
self._finished.set()
def run(self):
pid_file = True
while True:
if self._finished.isSet():
return
if common.pid_file_exists():
pid_file = True
elif pid_file:
self.trans.update_dbs()
set_icon(len(self.trans.get_updates()[1]))
pid_file = False
else:
self._finished.wait(self._interval)
def set_icon(updates): def set_icon(updates):
global icon global icon
@ -107,23 +134,18 @@ def set_icon(updates):
info = one_update_info info = one_update_info
else: else:
info = update_info.format(number = updates) info = update_info.format(number = updates)
tray.set_visible(True)
sleep(2)
if not common.pid_file_exists(): if not common.pid_file_exists():
Popen(['notify-send', '-i', '/usr/share/pamac/icons/32x32/apps/pamac-updater.png', '-u', 'normal', _('Update Manager'), info]) call(['notify-send', '-i', '/usr/share/pamac/icons/32x32/apps/pamac-updater.png', '-u', 'normal', _('Update Manager'), info])
else: else:
icon = noupdate_icon icon = noupdate_icon
info = noupdate_info info = noupdate_info
tray.set_visible(True)
print(info) print(info)
tray.update_icon(icon, info) tray.update_icon(icon, info)
return False
from pamac import transaction
bus = dbus.SystemBus()
bus.add_signal_receiver(set_icon, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates")
transaction.StopDaemon()
tray = Tray() tray = Tray()
t = PeriodicTask() t1 = PeriodicRefresh()
t.start() t1.start()
t2 = PeriodicCheck()
t2.start()
Gtk.main() Gtk.main()

112
pamac-updater.py Executable file → Normal file
View File

@ -1,6 +1,112 @@
#! /usr/bin/python3 #! /usr/bin/pkexec /usr/bin/python3
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
from pamac import main from gi.repository import Gtk, Gdk
import pyalpm
main.main('updater') from pamac import config, common, transaction
# i18n
import gettext
import locale
locale.bindtextdomain('pamac', '/usr/share/locale')
gettext.bindtextdomain('pamac', '/usr/share/locale')
gettext.textdomain('pamac')
_ = gettext.gettext
interface = transaction.interface
interface.add_from_file('/usr/share/pamac/gui/updater.ui')
UpdaterWindow = interface.get_object("UpdaterWindow")
update_listore = interface.get_object('update_list')
update_top_label = interface.get_object('update_top_label')
update_bottom_label = interface.get_object('update_bottom_label')
update_top_label.set_markup(_('<big><b>Your system is up-to-date</b></big>'))
update_bottom_label.set_markup('')
def have_updates():
do_syncfirst, updates = trans.get_updates()
update_listore.clear()
update_top_label.set_justify(Gtk.Justification.CENTER)
if not updates:
update_bottom_label.set_markup('')
update_top_label.set_markup(_('<big><b>Your system is up-to-date</b></big>'))
else:
dsize = 0
for pkg in updates:
pkgname = pkg.name+' '+pkg.version
update_listore.append([pkgname, common.format_size(pkg.size)])
dsize += pkg.download_size
if dsize == 0:
update_bottom_label.set_markup('')
else:
update_bottom_label.set_markup(_('<b>Total download size: </b>')+common.format_size(dsize))
if len(updates) == 1:
update_top_label.set_markup(_('<big><b>1 available update</b></big>'))
else:
update_top_label.set_markup(_('<big><b>{number} available updates</b></big>').format(number = len(updates)))
def on_TransValidButton_clicked(*arg):
transaction.ConfDialog.hide()
trans.finalize()
def on_TransCancelButton_clicked(*arg):
transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter())
transaction.ConfDialog.hide()
trans.release()
def on_ProgressCloseButton_clicked(*arg):
transaction.ProgressWindow.hide()
transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter())
have_updates()
def on_ProgressCancelButton_clicked(*args):
trans.interrupt()
def on_UpdaterWindow_delete_event(*arg):
Gtk.main_quit()
common.rm_pid_file()
def on_Updater_ApplyButton_clicked(*arg):
UpdaterWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending():
Gtk.main_iteration()
trans.do_sysupgrade(False)
UpdaterWindow.get_window().set_cursor(None)
def on_Updater_RefreshButton_clicked(*arg):
while Gtk.events_pending():
Gtk.main_iteration()
UpdaterWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
trans.refresh(False)
UpdaterWindow.get_window().set_cursor(None)
signals = {'on_ChooseButton_clicked' : transaction.on_ChooseButton_clicked,
'on_progress_textview_size_allocate' : transaction.on_progress_textview_size_allocate,
'on_choose_renderertoggle_toggled' : transaction.on_choose_renderertoggle_toggled,
'on_TransValidButton_clicked' :on_TransValidButton_clicked,
'on_TransCancelButton_clicked' :on_TransCancelButton_clicked,
'on_ProgressCloseButton_clicked' : on_ProgressCloseButton_clicked,
'on_ProgressCancelButton_clicked' : on_ProgressCancelButton_clicked,
'on_UpdaterWindow_delete_event' : on_UpdaterWindow_delete_event,
'on_Updater_ApplyButton_clicked' : on_Updater_ApplyButton_clicked,
'on_Updater_RefreshButton_clicked' : on_Updater_RefreshButton_clicked}
if common.pid_file_exists():
transaction.ErrorDialog.format_secondary_text(_('Pamac is already running'))
response = transaction.ErrorDialog.run()
if response:
transaction.ErrorDialog.hide()
else:
common.write_pid_file()
interface.connect_signals(signals)
UpdaterWindow.show_all()
trans = transaction.Transaction()
UpdaterWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending():
Gtk.main_iteration()
trans.refresh(False)
have_updates()
UpdaterWindow.get_window().set_cursor(None)
Gtk.main()

596
pamac.pot
View File

@ -20,312 +20,206 @@ msgstr ""
msgid "Authentication is required" msgid "Authentication is required"
msgstr "" msgstr ""
#: pamac-daemon.py:29 pamac/main.py:503 #: pamac-manager.py:75 pamac-manager.py:104 pamac-manager.py:105
msgid "Preparing" #: pamac-manager.py:120 pamac-manager.py:129 pamac-manager.py:235
msgstr "" #: pamac-manager.py:432 pamac-manager.py:493 pamac-manager.py:555
#: pamac-daemon.py:68
msgid "Checking dependencies"
msgstr ""
#: pamac-daemon.py:75
msgid "Checking file conflicts"
msgstr ""
#: pamac-daemon.py:78
msgid "Resolving dependencies"
msgstr ""
#: pamac-daemon.py:85
msgid "Checking inter conflicts"
msgstr ""
#: pamac-daemon.py:88 pamac/main.py:51
msgid "Installing"
msgstr ""
#: pamac-daemon.py:95 pamac/main.py:51
msgid "Removing"
msgstr ""
#: pamac-daemon.py:102 pamac/main.py:51
msgid "Upgrading"
msgstr ""
#: pamac-daemon.py:109 pamac/main.py:51
msgid "Downgrading"
msgstr ""
#: pamac-daemon.py:117 pamac/main.py:51
msgid "Reinstalling"
msgstr ""
#: pamac-daemon.py:125
msgid "Checking integrity"
msgstr ""
#: pamac-daemon.py:129
msgid "Loading packages files"
msgstr ""
#: pamac-daemon.py:133 pamac/main.py:51
msgid "Configuring"
msgstr ""
#: pamac-daemon.py:140
msgid "Checking keys in keyring"
msgstr ""
#: pamac-daemon.py:198
msgid "Downloading {size}"
msgstr ""
#: pamac-daemon.py:203 pamac/main.py:437 pamac/main.py:1126
msgid "Refreshing"
msgstr ""
#: pamac-daemon.py:371 pamac-install.py:44 pamac/main.py:531
msgid "{pkgname} is not a valid path or package name"
msgstr ""
#: pamac-daemon.py:438
msgid "Transaction successfully finished"
msgstr ""
#: pamac-daemon.py:442 pamac-daemon.py:450
msgid "Authentication failed"
msgstr ""
#: pamac-tray.py:22
msgid "{number} available updates"
msgstr ""
#: pamac-tray.py:23
msgid "1 available update"
msgstr ""
#: pamac-tray.py:25
msgid "Your system is up-to-date"
msgstr ""
#: pamac-tray.py:113 gui/updater.glade:7
msgid "Update Manager"
msgstr ""
#: pamac-install.py:73 pamac-install.py:79 pamac/main.py:915
msgid "Nothing to do"
msgstr ""
#: pamac-install.py:87 pamac/main.py:1177
msgid "Pamac is already running"
msgstr ""
#: pamac-install.py:97
msgid ""
"Some updates are available.\n"
"Please update your system first"
msgstr ""
#: pamac/main.py:88 pamac/main.py:1083
msgid "local"
msgstr ""
#: pamac/main.py:178 pamac/main.py:973 pamac/main.py:1034
msgid "No package found" msgid "No package found"
msgstr "" msgstr ""
#: pamac/main.py:229 #: pamac-manager.py:149 pamac-manager.py:185 pamac-manager.py:292
msgid "Licenses"
msgstr ""
#: pamac/main.py:234
msgid "Depends On"
msgstr ""
#: pamac/main.py:239 pamac/main.py:1066 pamac/main.py:1251
msgid "Installed" msgid "Installed"
msgstr "" msgstr ""
#: pamac/main.py:242 #: pamac-manager.py:149 pamac-manager.py:188
msgid "Optional Deps" msgid "Uninstalled"
msgstr "" msgstr ""
#: pamac/main.py:245 #: pamac-manager.py:149 pamac-manager.py:191
msgid "Required By" msgid "Orphans"
msgstr "" msgstr ""
#: pamac/main.py:247 #: pamac-manager.py:149 pamac-manager.py:171 pamac/transaction.py:668
msgid "Provides"
msgstr ""
#: pamac/main.py:249
msgid "Replaces"
msgstr ""
#: pamac/main.py:251
msgid "Conflicts With"
msgstr ""
#: pamac/main.py:256
msgid "Repository"
msgstr ""
#: pamac/main.py:258 gui/manager.glade:384
msgid "Groups"
msgstr ""
#: pamac/main.py:260
msgid "Compressed Size"
msgstr ""
#: pamac/main.py:261
msgid "Download Size"
msgstr ""
#: pamac/main.py:263
msgid "Installed Size"
msgstr ""
#: pamac/main.py:264
msgid "Packager"
msgstr ""
#: pamac/main.py:265
msgid "Architecture"
msgstr ""
#: pamac/main.py:268
msgid "Install Date"
msgstr ""
#: pamac/main.py:270
msgid "Explicitly installed"
msgstr ""
#: pamac/main.py:272
msgid "Installed as a dependency for another package"
msgstr ""
#: pamac/main.py:274
msgid "Unknown"
msgstr ""
#: pamac/main.py:275
msgid "Install Reason"
msgstr ""
#: pamac/main.py:280
msgid "Signatures"
msgstr ""
#: pamac/main.py:284
msgid "Backup files"
msgstr ""
#: pamac/main.py:324
msgid "<big><b>Transaction Summary</b></big>"
msgstr ""
#: pamac/main.py:326 pamac/main.py:1072 pamac/main.py:1251
msgid "To install" msgid "To install"
msgstr "" msgstr ""
#: pamac/main.py:332 #: pamac-manager.py:149 pamac-manager.py:176 pamac/transaction.py:660
msgid "To reinstall"
msgstr ""
#: pamac/main.py:338
msgid "To downgrade"
msgstr ""
#: pamac/main.py:344 pamac/main.py:1074 pamac/main.py:1251
msgid "To remove" msgid "To remove"
msgstr "" msgstr ""
#: pamac/main.py:351 #: pamac-manager.py:154 pamac-manager.py:203
msgid "To update" msgid "local"
msgstr "" msgstr ""
#: pamac/main.py:362 pamac/main.py:459 #: pamac-manager.py:282
msgid "<b>Total download size: </b>" msgid "Licenses"
msgstr "" msgstr ""
#: pamac/main.py:452 pamac/main.py:1263 #: pamac-manager.py:287
msgid "<big><b>Your system is up-to-date</b></big>" msgid "Depends On"
msgstr "" msgstr ""
#: pamac/main.py:461 #: pamac-manager.py:295
msgid "<big><b>1 available update</b></big>" msgid "Optional Deps"
msgstr "" msgstr ""
#: pamac/main.py:463 #: pamac-manager.py:298
msgid "<big><b>{number} available updates</b></big>" msgid "Required By"
msgstr "" msgstr ""
#: pamac/main.py:549 pamac/main.py:550 #: pamac-manager.py:300
msgid "" msgid "Provides"
"The transaction cannot be performed because it needs to remove {pkgname1} "
"which is a locked package"
msgstr "" msgstr ""
#: pamac/main.py:585 pamac/main.py:586 pamac/main.py:697 pamac/main.py:698 #: pamac-manager.py:302
msgid "{pkgname1} will be replaced by {pkgname2}" msgid "Replaces"
msgstr "" msgstr ""
#: pamac/main.py:714 pamac/main.py:715 pamac/main.py:739 pamac/main.py:740 #: pamac-manager.py:304
#: pamac/main.py:760 pamac/main.py:761 pamac/main.py:791 pamac/main.py:792 msgid "Conflicts With"
#: pamac/main.py:816 pamac/main.py:817 pamac/main.py:837 pamac/main.py:838
msgid "{pkgname1} conflicts with {pkgname2}"
msgstr "" msgstr ""
#: pamac/main.py:772 pamac/main.py:773 #: pamac-manager.py:309
msgid "" msgid "Repository"
"{pkgname1} conflicts with {pkgname2}\n"
"None of them will be installed"
msgstr "" msgstr ""
#: pamac/main.py:874 #: pamac-manager.py:311 gui/manager.ui:237
msgid "" msgid "Groups"
"<b>{pkgname} is provided by {number} packages.\n"
"Please choose the one(s) you want to install:</b>"
msgstr "" msgstr ""
#: pamac/main.py:957 #: pamac-manager.py:313
msgid "Compressed Size"
msgstr ""
#: pamac-manager.py:314
msgid "Download Size"
msgstr ""
#: pamac-manager.py:316
msgid "Installed Size"
msgstr ""
#: pamac-manager.py:317
msgid "Packager"
msgstr ""
#: pamac-manager.py:318
msgid "Architecture"
msgstr ""
#: pamac-manager.py:321
msgid "Install Date"
msgstr ""
#: pamac-manager.py:323
msgid "Explicitly installed"
msgstr ""
#: pamac-manager.py:325
msgid "Installed as a dependency for another package"
msgstr ""
#: pamac-manager.py:327
msgid "Unknown"
msgstr ""
#: pamac-manager.py:328
msgid "Install Reason"
msgstr ""
#: pamac-manager.py:333
msgid "Signatures"
msgstr ""
#: pamac-manager.py:337
msgid "Backup files"
msgstr ""
#: pamac-manager.py:408
#, python-brace-format
msgid "" msgid ""
"<b>{pkgname} has {number} uninstalled optional deps.\n" "<b>{pkgname} has {number} uninstalled optional deps.\n"
"Please choose the one(s) you want to install:</b>" "Please choose the one(s) you want to install:</b>"
msgstr "" msgstr ""
#: pamac/main.py:976 #: pamac-manager.py:435
msgid "Unselect" msgid "Unselect"
msgstr "" msgstr ""
#: pamac/main.py:982 #: pamac-manager.py:441
msgid "Remove" msgid "Remove"
msgstr "" msgstr ""
#: pamac/main.py:987 #: pamac-manager.py:446
msgid "Reinstall" msgid "Reinstall"
msgstr "" msgstr ""
#: pamac/main.py:1000 #: pamac-manager.py:459
msgid "Install optional deps" msgid "Install optional deps"
msgstr "" msgstr ""
#: pamac/main.py:1006 #: pamac-manager.py:465
msgid "Install" msgid "Install"
msgstr "" msgstr ""
#: pamac/main.py:1019 #: pamac-manager.py:478
msgid "Install with optional deps" msgid "Install with optional deps"
msgstr "" msgstr ""
#: pamac/main.py:1068 pamac/main.py:1251 #: pamac-manager.py:702 pamac-updater.py:97 pamac-install.py:71
msgid "Uninstalled" msgid "Pamac is already running"
msgstr "" msgstr ""
#: pamac/main.py:1070 pamac/main.py:1251 #: pamac-updater.py:25 pamac-updater.py:34
msgid "Orphans" msgid "<big><b>Your system is up-to-date</b></big>"
msgstr ""
#: pamac-updater.py:44 pamac/transaction.py:655
msgid "<b>Total download size: </b>"
msgstr ""
#: pamac-updater.py:46
msgid "<big><b>1 available update</b></big>"
msgstr ""
#: pamac-updater.py:48
#, python-brace-format
msgid "<big><b>{number} available updates</b></big>"
msgstr ""
#: pamac-tray.py:19
#, python-brace-format
msgid "{number} available updates"
msgstr ""
#: pamac-tray.py:20
msgid "1 available update"
msgstr ""
#: pamac-tray.py:22
msgid "Your system is up-to-date"
msgstr ""
#: pamac-tray.py:32 pamac-tray.py:138 gui/updater.ui:7
msgid "Update Manager"
msgstr ""
#: pamac-tray.py:36 gui/manager.ui:41
msgid "Package Manager"
msgstr ""
#: pamac-tray.py:40
msgid "Quit"
msgstr ""
#: pamac-install.py:55 pamac/transaction.py:559
#, python-brace-format
msgid "{pkgname} is not a valid path or package name"
msgstr ""
#: pamac-install.py:79
msgid ""
"Some updates are available.\n"
"Please update your system first"
msgstr "" msgstr ""
#: pamac/common.py:13 #: pamac/common.py:13
@ -338,58 +232,236 @@ msgstr ""
msgid "%.2f MiB" msgid "%.2f MiB"
msgstr "" msgstr ""
#: gui/manager.glade:6 #: pamac/transaction.py:50
msgid "Choose" #, python-brace-format
msgid ""
"<b>{pkgname} is provided by {number} packages.\n"
"Please choose the one you want to install:</b>"
msgstr "" msgstr ""
#: gui/manager.glade:109 #: pamac/transaction.py:174
msgid "Summary" msgid "Checking dependencies"
msgstr "" msgstr ""
#: gui/manager.glade:250 #: pamac/transaction.py:182
msgid "Package Manager" msgid "Checking file conflicts"
msgstr "" msgstr ""
#: gui/manager.glade:338 #: pamac/transaction.py:188
msgid "Resolving dependencies"
msgstr ""
#: pamac/transaction.py:194
msgid "Checking inter conflicts"
msgstr ""
#: pamac/transaction.py:202
#, python-brace-format
msgid "Installing {pkgname}"
msgstr ""
#: pamac/transaction.py:211
#, python-brace-format
msgid "Removing {pkgname}"
msgstr ""
#: pamac/transaction.py:220
#, python-brace-format
msgid "Upgrading {pkgname}"
msgstr ""
#: pamac/transaction.py:229
#, python-brace-format
msgid "Downgrading {pkgname}"
msgstr ""
#: pamac/transaction.py:238
#, python-brace-format
msgid "Reinstalling {pkgname}"
msgstr ""
#: pamac/transaction.py:247
msgid "Checking integrity"
msgstr ""
#: pamac/transaction.py:254
msgid "Loading packages files"
msgstr ""
#: pamac/transaction.py:260
msgid "Checking delta integrity"
msgstr ""
#: pamac/transaction.py:266
msgid "Applying deltas"
msgstr ""
#: pamac/transaction.py:272
msgid "Generating {} with {}"
msgstr ""
#: pamac/transaction.py:276
msgid "Generation succeeded!"
msgstr ""
#: pamac/transaction.py:279
msgid "Generation failed."
msgstr ""
#: pamac/transaction.py:282
#, python-brace-format
msgid "Configuring {pkgname}"
msgstr ""
#: pamac/transaction.py:291
msgid "Checking available disk space"
msgstr ""
#: pamac/transaction.py:301
msgid "Checking keyring"
msgstr ""
#: pamac/transaction.py:308
msgid "Downloading required keys"
msgstr ""
#: pamac/transaction.py:331
#, python-brace-format
msgid "{pkgname1} will replace by {pkgname2}\n"
msgstr ""
#: pamac/transaction.py:334
#, python-brace-format
msgid "{pkgname1} conflicts with {pkgname2}\n"
msgstr ""
#: pamac/transaction.py:383
#, python-brace-format
msgid "Refreshing {repo}"
msgstr ""
#: pamac/transaction.py:387
#, python-brace-format
msgid "Downloading {pkgname}"
msgstr ""
#: pamac/transaction.py:443
msgid "Refreshing"
msgstr ""
#: pamac/transaction.py:581
#, python-brace-format
msgid ""
"The transaction cannot be performed because it needs to remove {pkgname1} "
"which is a locked package"
msgstr ""
#: pamac/transaction.py:600 pamac/transaction.py:603
msgid "Transaction successfully finished"
msgstr ""
#: pamac/transaction.py:622
msgid ""
"The transaction was interrupted.\n"
"Now Pamac will quit."
msgstr ""
#: pamac/transaction.py:632
msgid "<big><b>Transaction Summary</b></big>"
msgstr ""
#: pamac/transaction.py:676
msgid "To reinstall"
msgstr ""
#: pamac/transaction.py:684
msgid "To downgrade"
msgstr ""
#: pamac/transaction.py:693
msgid "To update"
msgstr ""
#: pamac/transaction.py:754
msgid "Preparing"
msgstr ""
#: pamac/transaction.py:782
msgid "Nothing to do"
msgstr ""
#: gui/manager.ui:7
msgid "About Pamac"
msgstr ""
#: gui/manager.ui:10
msgid "Copyright © 2013 Guillaume Benoit"
msgstr ""
#: gui/manager.ui:11
msgid "A gtk3 frontend for pyalpm"
msgstr ""
#: gui/manager.ui:191
msgid "Search" msgid "Search"
msgstr "" msgstr ""
#: gui/manager.glade:431 gui/manager.glade:524 #: gui/manager.ui:284 gui/manager.ui:376
msgid "State" msgid "State"
msgstr "" msgstr ""
#: gui/manager.glade:478 #: gui/manager.ui:331
msgid "Repos" msgid "Repos"
msgstr "" msgstr ""
#: gui/manager.glade:540 #: gui/manager.ui:389
msgid "Name" msgid "Name"
msgstr "" msgstr ""
#: gui/manager.glade:558 #: gui/manager.ui:402
msgid "Version" msgid "Version"
msgstr "" msgstr ""
#: gui/manager.glade:574 #: gui/manager.ui:415
msgid "Size" msgid "Size"
msgstr "" msgstr ""
#: gui/manager.glade:675 #: gui/manager.ui:513
msgid "Infos" msgid "Infos"
msgstr "" msgstr ""
#: gui/manager.glade:735 #: gui/manager.ui:573
msgid "Deps" msgid "Deps"
msgstr "" msgstr ""
#: gui/manager.glade:800 #: gui/manager.ui:638
msgid "Details" msgid "Details"
msgstr "" msgstr ""
#: gui/manager.glade:848 #: gui/manager.ui:686
msgid "Files" msgid "Files"
msgstr "" msgstr ""
#: gui/manager.glade:970 #: gui/manager.ui:718
msgid "Install local packages"
msgstr ""
#: gui/manager.ui:806 gui/manager.ui:807
msgid " "
msgstr ""
#: gui/dialogs.ui:6
msgid "Choose"
msgstr ""
#: gui/dialogs.ui:108
msgid "Summary"
msgstr ""
#: gui/dialogs.ui:306
msgid "Progress" msgid "Progress"
msgstr "" msgstr ""
#: gui/dialogs.ui:398
msgid "details"
msgstr ""

File diff suppressed because it is too large Load Diff

View File

@ -2,97 +2,787 @@
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
import pyalpm import pyalpm
from collections import OrderedDict from gi.repository import Gtk
import dbus
from dbus.mainloop.glib import DBusGMainLoop
from pamac import config, common from pamac import config, common
to_remove = set() # i18n
to_add = set() import gettext
to_load = set() import locale
to_update = set() locale.bindtextdomain('pamac', '/usr/share/locale')
to_provide = set() gettext.bindtextdomain('pamac', '/usr/share/locale')
handle = None gettext.textdomain('pamac')
syncpkgs = OrderedDict() _ = gettext.gettext
localpkgs = OrderedDict()
def get_handle(): interface = Gtk.Builder()
global handle interface.set_translation_domain('pamac')
handle = config.handle()
print('get handle')
def update_db(): interface.add_from_file('/usr/share/pamac/gui/dialogs.ui')
#get_handle() ErrorDialog = interface.get_object('ErrorDialog')
global syncpkgs WarningDialog = interface.get_object('WarningDialog')
global localpkgs InfoDialog = interface.get_object('InfoDialog')
syncpkgs = OrderedDict() #QuestionDialog = interface.get_object('QuestionDialog')
localpkgs = OrderedDict() ConfDialog = interface.get_object('ConfDialog')
if handle: transaction_sum = interface.get_object('transaction_sum')
for repo in handle.get_syncdbs(): sum_top_label = interface.get_object('sum_top_label')
for pkg in repo.pkgcache: sum_bottom_label = interface.get_object('sum_bottom_label')
if not pkg.name in syncpkgs.keys(): ChooseDialog = interface.get_object('ChooseDialog')
syncpkgs[pkg.name] = pkg choose_list = interface.get_object('choose_list')
for pkg in handle.get_localdb().pkgcache: choose_label = interface.get_object('choose_label')
if not pkg.name in localpkgs.keys(): choose_renderertoggle = interface.get_object('choose_renderertoggle')
localpkgs[pkg.name] = pkg ProgressWindow = interface.get_object('ProgressWindow')
progress_bar = interface.get_object('progressbar2')
progress_label = interface.get_object('progresslabel2')
action_icon = interface.get_object('action_icon')
ProgressCancelButton = interface.get_object('ProgressCancelButton')
ProgressCloseButton = interface.get_object('ProgressCloseButton')
progress_textview = interface.get_object('progress_textview')
progress_expander = interface.get_object('progress_expander')
DBusGMainLoop(set_as_default = True) progress_buffer = progress_textview.get_buffer()
bus = dbus.SystemBus() choose_only_one = False
proxy = bus.get_object('org.manjaro.pamac','/org/manjaro/pamac', introspect = False)
Refresh = proxy.get_dbus_method('Refresh','org.manjaro.pamac')
Init = proxy.get_dbus_method('Init','org.manjaro.pamac')
Sysupgrade = proxy.get_dbus_method('Sysupgrade','org.manjaro.pamac')
Remove = proxy.get_dbus_method('Remove','org.manjaro.pamac')
Add = proxy.get_dbus_method('Add','org.manjaro.pamac')
Load = proxy.get_dbus_method('Load','org.manjaro.pamac')
Prepare = proxy.get_dbus_method('Prepare','org.manjaro.pamac')
To_Remove = proxy.get_dbus_method('To_Remove','org.manjaro.pamac')
To_Add = proxy.get_dbus_method('To_Add','org.manjaro.pamac')
Commit = proxy.get_dbus_method('Commit','org.manjaro.pamac')
Interrupt = proxy.get_dbus_method('Interrupt','org.manjaro.pamac')
Release = proxy.get_dbus_method('Release','org.manjaro.pamac')
StopDaemon = proxy.get_dbus_method('StopDaemon','org.manjaro.pamac')
def init_transaction(**options): def choose_provides(data):
error = Init(dbus.Dictionary(options, signature='sb')) global choose_only_one
if not error: choose_only_one = True
return True providers = data[0]
else: dep_to_provide = data[1]
return False choose_label.set_markup(_('<b>{pkgname} is provided by {number} packages.\nPlease choose the one you want to install:</b>').format(pkgname = dep_to_provide, number = str(len(providers))))
choose_list.clear()
choose_renderertoggle.set_radio(True)
for pkg in providers:
choose_list.append([False, pkg.name])
ChooseDialog.run()
index = 0
if to_provide:
for pkg in providers:
if to_provide[0] == pkg.name:
index = providers.index(pkg)
return index
def get_updates(): def on_choose_renderertoggle_toggled(widget, line):
"""Return a list of package objects in local db which can be updated""" global choose_only_one
do_syncfirst = False choose_list[line][0] = not choose_list[line][0]
list_first = [] if choose_only_one:
_ignorepkgs = [] for row in choose_list:
update_db() if not row[1] == choose_list[line][1]:
if handle: row[0] = False
for group in handle.ignoregrps:
db = handle.get_localdb() def on_ChooseButton_clicked(*arg):
grp = db.read_grp(group) ChooseDialog.hide()
if grp: line = 0
name, pkg_list = grp to_provide.clear()
for pkg in pkg_list: while line < len(choose_list):
if not pkg.name in _ignorepkgs: if choose_list[line][0] is True:
_ignorepkgs.append(pkg.name) to_provide.append(choose_list[line][1])
for pkgname in handle.ignorepkgs: line += 1
if pkgname in localpkgs.keys():
if not pkgname in _ignorepkgs: def on_progress_textview_size_allocate(*arg):
_ignorepkgs.append(pkgname) #auto-scrolling method
if config.syncfirst: adj = progress_textview.get_vadjustment()
for name in config.syncfirst: adj.set_value(adj.get_upper() - adj.get_page_size())
if name in localpkgs.keys():
candidate = pyalpm.sync_newversion(localpkgs[name], handle.get_syncdbs()) #~ def policykit_test(sender, connexion, action):
if candidate: #~ bus = dbus.SystemBus()
list_first.append(candidate) #~ proxy_dbus = connexion.get_object('org.freedesktop.DBus','/org/freedesktop/DBus/Bus', False)
if list_first: #~ dbus_info = dbus.Interface(proxy_dbus,'org.freedesktop.DBus')
do_syncfirst = True #~ sender_pid = dbus_info.GetConnectionUnixProcessID(sender)
return do_syncfirst, list_first #~ proxy_policykit = bus.get_object('org.freedesktop.PolicyKit1','/org/freedesktop/PolicyKit1/Authority',False)
result = [] #~ policykit_authority = dbus.Interface(proxy_policykit,'org.freedesktop.PolicyKit1.Authority')
for pkg in localpkgs.values(): #~
candidate = pyalpm.sync_newversion(pkg, handle.get_syncdbs()) #~ Subject = ('unix-process', {'pid': dbus.UInt32(sender_pid, variant_level=1),
if candidate: #~ 'start-time': dbus.UInt64(0, variant_level=1)})
if not candidate.name in _ignorepkgs: #~ (is_authorized,is_challenge,details) = policykit_authority.CheckAuthorization(Subject, action, {'': ''}, dbus.UInt32(1), '')
result.append(candidate) #~ return is_authorized
return do_syncfirst, result
#~ def sort_pkgs_list(self, pkgs_list):
#~ result = []
#~ names_list = sorted([pkg.name for pkg in pkgs_list])
#~ for name in names_list:
#~ for pkg in pkgs_list:
#~ if name == pkg.name:
#~ result.append(pkg)
#~ return result
def remove_pkg_from_list(pkg, pkgs_list):
if pkgs_list:
for _pkg in pkgs_list:
if (pkg.name == _pkg.name and pkg.version == _pkg.version and pkg.arch == _pkg.arch):
target = _pkg
pkgs_list.remove(_pkg)
def pkg_in_list(pkg, pkgs_list):
result = False
if pkgs_list:
for _pkg in pkgs_list:
if (pkg.name == _pkg.name and pkg.version == _pkg.version and pkg.arch == _pkg.arch):
result = True
return result
class Transaction():
def __init__(self):
self.t = None
self.to_remove = []
self.to_add = []
self.to_load = []
self.to_provide = []
self.error = ''
self.warning = ''
self.previous_action = ''
self.previous_action_long = ''
self.previous_icon = ''
self.previous_target = ''
self.previous_percent = 0
self.total_size = 0
self.already_transferred = 0
self.handle = config.handle()
self.syncdbs = self.handle.get_syncdbs()
self.localdb = self.handle.get_localdb()
self.handle.dlcb = self.cb_dl
self.handle.totaldlcb = self.totaldlcb
self.handle.eventcb = self.cb_event
self.handle.questioncb = self.cb_question
self.handle.progresscb = self.cb_progress
self.handle.logcb = self.cb_log
def update_dbs(self):
self.handle = config.handle()
self.syncdbs = self.handle.get_syncdbs()
self.localdb = self.handle.get_localdb()
self.handle.dlcb = self.cb_dl
self.handle.totaldlcb = self.totaldlcb
self.handle.eventcb = self.cb_event
self.handle.questioncb = self.cb_question
self.handle.progresscb = self.cb_progress
self.handle.logcb = self.cb_log
def get_localpkg(self, name):
return self.localdb.get_pkg(name)
def get_syncpkg(self, name):
for repo in self.syncdbs:
pkg = repo.get_pkg(name)
if pkg:
return pkg
def cb_event(self, event, tupel):
global progress_buffer
action = self.previous_action
action_long = self.previous_action_long
icon = self.previous_icon
if event == 'ALPM_EVENT_CHECKDEPS_START':
action = _('Checking dependencies')+'...'
action_long = action+'\n'
icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif event == 'ALPM_EVENT_CHECKDEPS_DONE':
if self.warning:
self.handle_warning(self.warning)
self.warning = ''
elif event == 'ALPM_EVENT_FILECONFLICTS_START':
action = _('Checking file conflicts')+'...'
action_long = action+'\n'
icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif event == 'ALPM_EVENT_FILECONFLICTS_DONE':
pass
elif event == 'ALPM_EVENT_RESOLVEDEPS_START':
action = _('Resolving dependencies')+'...'
action_long = action+'\n'
icon = '/usr/share/pamac/icons/24x24/status/package-setup.png'
elif event == 'ALPM_EVENT_RESOLVEDEPS_DONE':
pass
elif event == 'ALPM_EVENT_INTERCONFLICTS_START':
action = _('Checking inter conflicts')+'...'
action_long = action+'\n'
icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif event == 'ALPM_EVENT_INTERCONFLICTS_DONE':
if self.warning:
self.handle_warning(self.warning)
self.warning = ''
elif event == 'ALPM_EVENT_ADD_START':
string = _('Installing {pkgname}').format(pkgname = tupel[0].name)
action = string+'...'
action_long = '{} ({})\n'.format(string, tupel[0].version)
icon = '/usr/share/pamac/icons/24x24/status/package-add.png'
ProgressCancelButton.set_visible(False)
elif event == 'ALPM_EVENT_ADD_DONE':
formatted_event = 'Installed {pkgname} ({pkgversion})'.format(pkgname = tupel[0].name, pkgversion = tupel[0].version)
common.write_log_file(formatted_event)
elif event == 'ALPM_EVENT_REMOVE_START':
string = _('Removing {pkgname}').format(pkgname = tupel[0].name)
action = string+'...'
action_long = '{} ({})\n'.format(string, tupel[0].version)
icon = '/usr/share/pamac/icons/24x24/status/package-delete.png'
ProgressCancelButton.set_visible(False)
elif event == 'ALPM_EVENT_REMOVE_DONE':
formatted_event = 'Removed {pkgname} ({pkgversion})'.format(pkgname = tupel[0].name, pkgversion = tupel[0].version)
common.write_log_file(formatted_event)
elif event == 'ALPM_EVENT_UPGRADE_START':
string = _('Upgrading {pkgname}').format(pkgname = tupel[1].name)
action = string+'...'
action_long = '{} ({} -> {})\n'.format(string, tupel[1].version, tupel[0].version)
icon = '/usr/share/pamac/icons/24x24/status/package-update.png'
ProgressCancelButton.set_visible(False)
elif event == 'ALPM_EVENT_UPGRADE_DONE':
formatted_event = 'Upgraded {pkgname} ({oldversion} -> {newversion})'.format(pkgname = tupel[1].name, oldversion = tupel[1].version, newversion = tupel[0].version)
common.write_log_file(formatted_event)
elif event == 'ALPM_EVENT_DOWNGRADE_START':
string = _('Downgrading {pkgname}').format(pkgname = tupel[1].name)
action = string+'...'
action_long = '{} ({} -> {})'.format(string, tupel[1].version, tupel[0].version)
icon = '/usr/share/pamac/icons/24x24/status/package-add.png'
ProgressCancelButton.set_visible(False)
elif event == 'ALPM_EVENT_DOWNGRADE_DONE':
formatted_event = 'Downgraded {pkgname} ({oldversion} -> {newversion})'.format(pkgname = tupel[1].name, oldversion = tupel[1].version, newversion = tupel[0].version)
common.write_log_file(formatted_event)
elif event == 'ALPM_EVENT_REINSTALL_START':
string = _('Reinstalling {pkgname}').format(pkgname = tupel[0].name)
action = string+'...'
action_long = '{} ({})'.format(string, tupel[0].version)
icon = '/usr/share/pamac/icons/24x24/status/package-add.png'
ProgressCancelButton.set_visible(False)
elif event == 'ALPM_EVENT_REINSTALL_DONE':
formatted_event = 'Reinstalled {pkgname} ({pkgversion})'.format(pkgname = tupel[0].name, pkgversion = tupel[0].version)
common.write_log_file(formatted_event)
elif event == 'ALPM_EVENT_INTEGRITY_START':
action = _('Checking integrity')+'...'
action_long = action+'\n'
icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
self.already_transferred = 0
elif event == 'ALPM_EVENT_INTEGRITY_DONE':
pass
elif event == 'ALPM_EVENT_LOAD_START':
action = _('Loading packages files')+'...'
action_long = action+'\n'
icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif event == 'ALPM_EVENT_LOAD_DONE':
pass
elif event == 'ALPM_EVENT_DELTA_INTEGRITY_START':
action = _('Checking delta integrity')+'...'
action_long = action+'\n'
icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif event == 'ALPM_EVENT_DELTA_INTEGRITY_DONE':
pass
elif event == 'ALPM_EVENT_DELTA_PATCHES_START':
action = _('Applying deltas')+'...'
action_long = action+'\n'
icon = '/usr/share/pamac/icons/24x24/status/package-setup.png'
elif event == 'ALPM_EVENT_DELTA_PATCHES_DONE':
pass
elif event == 'ALPM_EVENT_DELTA_PATCH_START':
action = _('Generating {} with {}').format(tupel[0], tupel[1])+'...'
action_long = action+'\n'
icon = '/usr/share/pamac/icons/24x24/status/package-setup.png'
elif event == 'ALPM_EVENT_DELTA_PATCH_DONE':
action = _('Generation succeeded!')
action_long = action+'\n'
elif event == 'ALPM_EVENT_DELTA_PATCH_FAILED':
action = _('Generation failed.')
action_long = action+'\n'
elif event == 'ALPM_EVENT_SCRIPTLET_INFO':
action =_('Configuring {pkgname}').format(pkgname = self.previous_target)+'...'
action_long = tupel[0]
icon = '/usr/share/pamac/icons/24x24/status/package-setup.png'
progress_bar.pulse()
progress_expander.set_expanded(True)
elif event == 'ALPM_EVENT_RETRIEVE_START':
# handled by download callback
ProgressCancelButton.set_visible(True)
elif event == 'ALPM_EVENT_DISKSPACE_START':
action = _('Checking available disk space')+'...'
action_long = action+'\n'
icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif event == 'ALPM_EVENT_OPTDEP_REQUIRED':
print('Optionnal deps exist')
elif event == 'ALPM_EVENT_DATABASE_MISSING':
#action =_('Database file for {} does not exist').format(tupel[0])+'...'
#action_long = action
pass
elif event == 'ALPM_EVENT_KEYRING_START':
action = _('Checking keyring')+'...'
action_long = action+'\n'
icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
ProgressCancelButton.set_visible(True)
elif event == 'ALPM_EVENT_KEYRING_DONE':
pass
elif event == 'ALPM_EVENT_KEY_DOWNLOAD_START':
action = _('Downloading required keys')+'...'
action_long = action+'\n'
elif event == 'ALPM_EVENT_KEY_DOWNLOAD_DONE':
pass
if action != self.previous_action:
self.previous_action = action
progress_label.set_text(action)
if action_long != self.previous_action_long:
self.previous_action_long != action_long
end_iter = progress_buffer.get_end_iter()
progress_buffer.insert(end_iter, action_long)
if icon != self.previous_icon:
self.previous_icon = icon
action_icon.set_from_file(icon)
while Gtk.events_pending():
Gtk.main_iteration()
print(event)
def cb_question(self, event, data_tupel, extra_data):
print('question', event, data_tupel, extra_data)
if event == 'ALPM_QUESTION_INSTALL_IGNOREPKG':
return 0 #Do not install package in IgnorePkg/IgnoreGroup
if event == 'ALPM_QUESTION_REPLACE_PKG':
self.warning += _('{pkgname1} will replace by {pkgname2}\n').format(pkgname1 = data_tupel[0].name, pkgname2 = data_tupel[1].name)
return 1 #Auto-remove conflicts in case of replaces
if event == 'ALPM_QUESTION_CONFLICT_PKG':
self.warning += _('{pkgname1} conflicts with {pkgname2}\n').format(pkgname1 = data_tupel[0], pkgname2 = data_tupel[1])
return 1 #Auto-remove conflicts
if event == 'ALPM_QUESTION_CORRUPTED_PKG':
return 1 #Auto-remove corrupted pkgs in cache
if event == 'ALPM_QUESTION_REMOVE_PKGS':
return 1 #Do not upgrade packages which have unresolvable dependencies
if event == 'ALPM_QUESTION_SELECT_PROVIDER':
return choose_provides(data_tupel)
if event == 'ALPM_QUESTION_IMPORT_KEY':
# data_tupel = (revoked(int), length(int), pubkey_algo(string), fingerprint(string), uid(string), created_time(int))
if data_tupel[0] is 0: # not revoked
return 1 #Auto import not revoked key
if data_tupel[0] is 1: # revoked
return 0 #Do not import revoked key
def cb_log(self, level, line):
global progress_buffer
_logmask = pyalpm.LOG_ERROR | pyalpm.LOG_WARNING
if not (level & _logmask):
return
if level & pyalpm.LOG_ERROR:
self.error += line
_error = "ERROR: "+line
end_iter = progress_buffer.get_end_iter()
progress_buffer.insert(end_iter, _error)
progress_expander.set_expanded(True)
while Gtk.events_pending():
Gtk.main_iteration()
print(line)
elif level & pyalpm.LOG_WARNING:
self.warning += line
_warning = "WARNING: "+line
end_iter = progress_buffer.get_end_iter()
progress_buffer.insert(end_iter, _warning)
while Gtk.events_pending():
Gtk.main_iteration()
elif level & pyalpm.LOG_DEBUG:
line = "DEBUG: " + line
print(line)
elif level & pyalpm.LOG_FUNCTION:
line = "FUNC: " + line
print(line)
def totaldlcb(self, _total_size):
self.total_size = _total_size
def cb_dl(self, _target, _transferred, _total):
global progress_buffer
if _target.endswith('.db'):
action = _('Refreshing {repo}').format(repo = _target.rstrip('.db'))+'...'
action_long = ''
icon = '/usr/share/pamac/icons/24x24/status/refresh-cache.png'
else:
action = _('Downloading {pkgname}').format(pkgname = _target.rstrip('.pkg.tar.xz'))+'...'
action_long = action+'\n'
icon = '/usr/share/pamac/icons/24x24/status/package-download.png'
if self.total_size > 0:
percent = round((_transferred+self.already_transferred)/self.total_size, 2)
#~ target = '{transferred}/{size}'.format(transferred = common.format_size(_transferred+self.already_transferred), size = common.format_size(self.total_size))
else:
percent = round(_transferred/_total, 2)
#~ percent = 2.0
#~ target = ''
if action != self.previous_action:
self.previous_action = action
progress_label.set_text(action)
if action_long != self.previous_action_long:
self.previous_action_long = action_long
end_iter = progress_buffer.get_end_iter()
progress_buffer.insert(end_iter, action_long)
if icon != self.previous_icon:
self.previous_icon = icon
action_icon.set_from_file(icon)
#~ if target != self.previous_target:
#~ self.previous_target = target
#~ progress_bar.set_text(target)
#~ if percent == 2.0:
#~ progress_bar.pulse()
elif percent != self.previous_percent:
self.previous_percent = percent
if 0 <= percent <= 1:
progress_bar.set_fraction(percent)
else:
progress_bar.pulse()
elif _transferred == _total:
self.already_transferred += _total
#~ if self.already_transferred == self.total_size:
#~ progress_bar.set_text('')
while Gtk.events_pending():
Gtk.main_iteration()
def cb_progress(self, event, target, _percent, n, i):
if event in ('ALPM_PROGRESS_ADD_START', 'ALPM_PROGRESS_UPGRADE_START', 'ALPM_PROGRESS_DOWNGRADE_START', 'ALPM_PROGRESS_REINSTALL_START', 'ALPM_PROGRESS_REMOVE_START'):
percent = round(((i-1)/n)+(_percent/(100*n)), 2)
else:
percent = round(_percent/100, 2)
if target != self.previous_target:
self.previous_target = target.format()
if percent != self.previous_percent:
progress_bar.set_text('{}/{}'.format(str(i), str(n)))
self.previous_percent = percent
if 0 <= percent <= 1:
progress_bar.set_fraction(percent)
else:
progress_bar.pulse()
while Gtk.events_pending():
Gtk.main_iteration()
def refresh(self, force_update):
progress_label.set_text(_('Refreshing')+'...')
action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/refresh-cache.png')
progress_bar.set_text('')
progress_bar.set_fraction(0)
ProgressCloseButton.set_visible(False)
ProgressCancelButton.set_visible(True)
ProgressWindow.show()
while Gtk.events_pending():
Gtk.main_iteration()
self.error = ''
for db in self.syncdbs:
try:
self.t = self.handle.init_transaction()
db.update(force = force_update)
self.t.release()
except pyalpm.error as e:
self.release()
self.error += str(e)+'\n'
break
self.update_dbs()
ProgressWindow.hide()
if self.error:
self.handle_error(self.error)
def get_updates(self):
do_syncfirst = False
list_first = set()
_ignorepkgs = set()
if self.handle:
for group in self.handle.ignoregrps:
db = self.handle.get_localdb()
grp = db.read_grp(group)
if grp:
name, pkg_list = grp
for pkg in pkg_list:
_ignorepkgs.add(pkg.name)
for name in self.handle.ignorepkgs:
if self.get_localpkg(name):
_ignorepkgs.add(name)
if config.syncfirst:
for name in config.syncfirst:
if self.get_localpkg(name):
candidate = pyalpm.sync_newversion(self.get_localpkg(name), self.syncdbs)
if candidate:
list_first.add(candidate)
if list_first:
do_syncfirst = True
return do_syncfirst, list_first
result = set()
for pkg in self.localdb.pkgcache:
candidate = pyalpm.sync_newversion(pkg, self.syncdbs)
if candidate:
if not candidate.name in _ignorepkgs:
result.add(candidate)
return do_syncfirst, result
def init(self, **options):
self.error = ''
try:
self.t = self.handle.init_transaction(**options)
except pyalpm.error as e:
self.error += str(e)+'\n'
finally:
if self.error:
self.handle_error(self.error)
return False
else:
return True
def sysupgrade(self, force_downgrade):
try:
self.t.sysupgrade(downgrade = force_downgrade)
except pyalpm.error as e:
self.error += str(e)+'\n'
self.t.release()
finally:
if self.error:
self.handle_error(self.error)
return False
else:
return True
def remove(self, pkg):
try:
self.t.remove_pkg(pkg)
except pyalpm.error as e:
self.error += str(e)+'\n'
self.t.release()
finally:
if self.error:
self.handle_error(self.error)
return False
else:
return True
def add(self, pkg):
try:
self.t.add_pkg(pkg)
except pyalpm.error as e:
# skip duplicate target error
if not 'pm_errno 25' in str(e):
self.error += str(e)+'\n'
self.t.release()
finally:
if self.error:
self.handle_error(self.error)
return False
else:
return True
def load(self, tarball_path):
try:
pkg = self.handle.load_pkg(tarball_path)
if pkg:
self.t.add_pkg(pkg)
else:
self.error += _('{pkgname} is not a valid path or package name').format(pkgname = tarball_path)
except pyalpm.error as e:
# skip duplicate target error
if not 'pm_errno 25' in str(e):
self.error += str(e)+'\n'
self.t.release()
finally:
if self.error:
self.handle_error(self.error)
return False
else:
return True
def prepare(self):
try:
self.t.prepare()
except pyalpm.error as e:
self.error += str(e)+'\n'
self.t.release()
else:
for pkg in self.t.to_remove:
if pkg.name in config.holdpkg:
self.error += _('The transaction cannot be performed because it needs to remove {pkgname1} which is a locked package').format(pkgname1 = pkg.name)
self.t.release()
break
finally:
if self.error:
self.handle_error(self.error)
return False
else:
return True
def commit(self):
try:
self.t.commit()
except pyalpm.error as e:
self.error += str(e)+'\n'
else:
global progress_buffer
ProgressCloseButton.set_visible(True)
action_icon.set_from_icon_name('dialog-information', Gtk.IconSize.BUTTON)
progress_label.set_text(_('Transaction successfully finished'))
progress_bar.set_text('')
end_iter = progress_buffer.get_end_iter()
progress_buffer.insert(end_iter, _('Transaction successfully finished'))
finally:
self.release()
if self.warning:
self.handle_warning(self.warning)
self.warning = ''
if self.error:
self.handle_error(self.error)
def interrupt(self):
try:
self.t.interrupt()
except:
pass
try:
self.t.release()
except:
pass
# Fix me, pyalpm don't stop so we inform and force quit to really interrupt the transaction
InfoDialog.format_secondary_text(_('The transaction was interrupted.\nNow Pamac will quit.'))
response = InfoDialog.run()
if response:
InfoDialog.hide()
common.rm_pid_file()
print('interrupted')
exit(0)
def set_transaction_sum(self, show_updates):
transaction_sum.clear()
sum_top_label.set_markup(_('<big><b>Transaction Summary</b></big>'))
_to_remove = self.t.to_remove
_to_install = []
_to_reinstall = []
_to_downgrade = []
_to_update = []
dsize = 0
for pkg in self.t.to_add:
dsize += pkg.download_size
installed = self.get_localpkg(pkg.name)
if not installed:
_to_install.append(pkg)
else:
comp = pyalpm.vercmp(pkg.version, installed.version)
if comp == 0:
_to_reinstall.append(pkg)
elif comp == -1:
_to_downgrade.append(pkg)
elif comp == 1:
_to_update.append(pkg)
if dsize == 0:
sum_bottom_label.set_markup('')
else:
sum_bottom_label.set_markup(_('<b>Total download size: </b>')+common.format_size(dsize))
i = 0
while i < len(_to_remove):
pkg = _to_remove[i]
if i == 0:
transaction_sum.append([_('To remove')+':', pkg.name+' '+pkg.version])
else:
transaction_sum.append(['', pkg.name+' '+pkg.version])
i += 1
i = 0
while i < len(_to_install):
pkg = _to_install[i]
if i == 0:
transaction_sum.append([_('To install')+':', pkg.name+' '+pkg.version])
else:
transaction_sum.append(['', pkg.name+' '+pkg.version])
i += 1
i = 0
while i < len(_to_reinstall):
pkg = _to_reinstall[i]
if i == 0:
transaction_sum.append([_('To reinstall')+':', pkg.name+' '+pkg.version])
else:
transaction_sum.append(['', pkg.name+' '+pkg.version])
i += 1
i = 0
while i < len(_to_downgrade):
pkg = _to_downgrade[i]
if i == 0:
transaction_sum.append([_('To downgrade')+':', pkg.name+' '+pkg.version])
else:
transaction_sum.append(['', pkg.name+' '+pkg.version])
i += 1
if show_updates:
i = 0
while i < len(_to_update):
pkg = _to_update[i]
if i == 0:
transaction_sum.append([_('To update')+':', pkg.name+' '+pkg.version])
else:
transaction_sum.append(['', pkg.name+' '+pkg.version])
i += 1
def handle_error(self, error):
ProgressWindow.hide()
print(error)
ErrorDialog.format_secondary_text(error)
response = ErrorDialog.run()
if response:
ErrorDialog.hide()
def handle_warning(self, warning):
WarningDialog.format_secondary_text(warning)
response = WarningDialog.run()
if response:
WarningDialog.hide()
def do_sysupgrade(self, show_updates):
do_syncfirst, to_update = self.get_updates()
if to_update:
self.to_add.clear()
self.to_remove.clear()
self.error = ''
if do_syncfirst:
if self.init(recurse = True):
for pkg in to_update:
self.add(pkg)
if self.prepare():
self.set_transaction_sum(show_updates)
if show_updates:
ConfDialog.show_all()
while Gtk.events_pending():
Gtk.main_iteration()
else:
if len(transaction_sum) != 0:
ConfDialog.show_all()
while Gtk.events_pending():
Gtk.main_iteration()
else:
self.finalize()
else:
if self.init():
if self.sysupgrade(False):
if self.prepare():
self.set_transaction_sum(show_updates)
if show_updates:
ConfDialog.show_all()
while Gtk.events_pending():
Gtk.main_iteration()
else:
if len(transaction_sum) != 0:
ConfDialog.show_all()
while Gtk.events_pending():
Gtk.main_iteration()
else:
self.finalize()
def finalize(self):
global progress_buffer
progress_label.set_text(_('Preparing')+'...')
action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-setup.png')
progress_bar.set_text('')
progress_bar.set_fraction(0)
progress_buffer.delete(progress_buffer.get_start_iter(),progress_buffer.get_end_iter())
ProgressCloseButton.set_visible(False)
ProgressWindow.show()
while Gtk.events_pending():
Gtk.main_iteration()
self.commit()
self.to_add.clear()
self.to_remove.clear()
def run(self):
if self.to_add or self.to_remove or self.to_load:
if self.init(cascade = True):
for pkg in self.to_add:
self.add(pkg)
for pkg in self.to_remove:
self.remove(pkg)
for path in self.to_load:
self.load(path)
if self.prepare():
self.set_transaction_sum(True)
ConfDialog.show()
while Gtk.events_pending():
Gtk.main_iteration()
else:
self.handle_warning(_('Nothing to do'))
def release(self):
try:
self.t.release()
except:
pass

View File

@ -3,7 +3,7 @@
from distutils.core import setup from distutils.core import setup
setup(name='Pamac', setup(name='Pamac',
version='0.7', version='0.8',
description='A gtk3 frontend for pyalpm', description='A gtk3 frontend for pyalpm',
license='GPL', license='GPL',
author='Guillaume Benoit', author='Guillaume Benoit',

View File

@ -1,3 +0,0 @@
#! /bin/sh
/usr/bin/pamac-daemon &