fix scroll up/down with keyboard

This commit is contained in:
guinux 2013-04-30 18:06:47 +02:00
parent 6ceb3d234f
commit f560beb1ba
3 changed files with 63 additions and 45 deletions

View File

@ -667,6 +667,7 @@
<property name="fixed_height_mode">True</property> <property name="fixed_height_mode">True</property>
<property name="show_expanders">False</property> <property name="show_expanders">False</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="move-cursor" handler="on_list_treeview_move_cursor" swapped="no"/>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection" id="list_treeview_selection"/> <object class="GtkTreeSelection" id="list_treeview_selection"/>
</child> </child>
@ -1136,6 +1137,24 @@
</object> </object>
</child> </child>
</object> </object>
<object class="GtkListStore" id="repos_list">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="search_list">
<columns>
<!-- column-name terms -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="state_list">
<columns>
<!-- column-name state -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="packages_list"> <object class="GtkListStore" id="packages_list">
<columns> <columns>
<!-- column-name name --> <!-- column-name name -->
@ -1156,24 +1175,6 @@
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkListStore" id="repos_list">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="search_list">
<columns>
<!-- column-name terms -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="state_list">
<columns>
<!-- column-name state -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="transaction_sum"> <object class="GtkListStore" id="transaction_sum">
<columns> <columns>
<!-- column-name action --> <!-- column-name action -->

View File

@ -277,6 +277,7 @@ class PamacDBusService(dbus.service.Object):
self.target = '' self.target = ''
self.percent = 0 self.percent = 0
self.error = '' self.error = ''
self.get_handle()
for db in self.handle.get_syncdbs(): for db in self.handle.get_syncdbs():
try: try:
self.t = self.handle.init_transaction() self.t = self.handle.init_transaction()
@ -298,22 +299,22 @@ class PamacDBusService(dbus.service.Object):
self.task.start() self.task.start()
success('') success('')
@dbus.service.method('org.manjaro.pamac', 'a{sb}', 's', sender_keyword='sender', connection_keyword='connexion') @dbus.service.method('org.manjaro.pamac', 'a{sb}', 's')#, sender_keyword='sender', connection_keyword='connexion')
def Init(self, options, sender=None, connexion=None): def Init(self, options):#, sender=None, connexion=None):
self.error = '' self.error = ''
if self.policykit_test(sender,connexion,'org.manjaro.pamac.init_release'): #if self.policykit_test(sender,connexion,'org.manjaro.pamac.init_release'):
try: try:
self.get_handle() self.get_handle()
self.t = self.handle.init_transaction(**options) self.t = self.handle.init_transaction(**options)
print('Init:',self.t.flags) print('Init:',self.t.flags)
except pyalpm.error as e: except pyalpm.error as e:
self.error += ' --> '+str(e)+'\n' self.error += ' --> '+str(e)+'\n'
finally: finally:
if self.error: if self.error:
self.EmitTransactionError(self.error) self.EmitTransactionError(self.error)
return self.error return self.error
else: #else:
return _('Authentication failed') # return _('Authentication failed')
@dbus.service.method('org.manjaro.pamac', '', 's') @dbus.service.method('org.manjaro.pamac', '', 's')
def Sysupgrade(self): def Sysupgrade(self):
@ -373,7 +374,7 @@ class PamacDBusService(dbus.service.Object):
print(e) print(e)
self.error += ' --> '+str(e)+'\n' self.error += ' --> '+str(e)+'\n'
finally: finally:
return self.error return self.error
@dbus.service.method('org.manjaro.pamac', '', 'a(ss)') @dbus.service.method('org.manjaro.pamac', '', 'a(ss)')
def To_Remove(self): def To_Remove(self):
@ -449,18 +450,18 @@ class PamacDBusService(dbus.service.Object):
def EmitTransactionError(self, message): def EmitTransactionError(self, message):
pass pass
@dbus.service.method('org.manjaro.pamac', '', 's', sender_keyword='sender', connection_keyword='connexion') @dbus.service.method('org.manjaro.pamac', '', 's')#, sender_keyword='sender', connection_keyword='connexion')
def Release(self, sender=None, connexion=None): def Release(self):#, sender=None, connexion=None):
self.error = '' self.error = ''
if self.policykit_test(sender,connexion,'org.manjaro.pamac.init_release'): #if self.policykit_test(sender,connexion,'org.manjaro.pamac.init_release'):
try: try:
self.t.release() self.t.release()
except pyalpm.error as e: except pyalpm.error as e:
self.error += ' --> '+str(e)+'\n' self.error += ' --> '+str(e)+'\n'
finally: finally:
return self.error return self.error
else : #else :
return _('Authentication failed') # return _('Authentication failed')
@dbus.service.method('org.manjaro.pamac') @dbus.service.method('org.manjaro.pamac')
def StopDaemon(self): def StopDaemon(self):

View File

@ -959,6 +959,22 @@ class Handler:
current_filter = ('search', search_entry.get_text().split()) current_filter = ('search', search_entry.get_text().split())
set_packages_list() set_packages_list()
def on_list_treeview_move_cursor(self, treeview, step, count):
liststore, treeiter = treeview.get_selection().get_selected()
if treeiter:
if packages_list[treeiter][0] != _('No package found'):
if packages_list[treeiter][0] in transaction.localpkgs.keys():
set_infos_list(transaction.localpkgs[packages_list[treeiter][0]])
set_deps_list(transaction.localpkgs[packages_list[treeiter][0]], "local")
set_details_list(transaction.localpkgs[packages_list[treeiter][0]], "local")
set_files_list(transaction.localpkgs[packages_list[treeiter][0]])
files_scrolledwindow.set_visible(True)
elif packages_list[treeiter][0] in transaction.syncpkgs.keys():
set_infos_list(transaction.syncpkgs[packages_list[treeiter][0]])
set_deps_list(transaction.syncpkgs[packages_list[treeiter][0]], "sync")
set_details_list(transaction.syncpkgs[packages_list[treeiter][0]], "sync")
files_scrolledwindow.set_visible(False)
def on_list_treeview_button_press_event(self, treeview, event): def on_list_treeview_button_press_event(self, treeview, event):
if event.button == 1: # left click if event.button == 1: # left click
treepath, viewcolumn, x, y = treeview.get_path_at_pos(int(event.x), int(event.y)) treepath, viewcolumn, x, y = treeview.get_path_at_pos(int(event.x), int(event.y))