summaryrefslogtreecommitdiff
path: root/portato/gui/windows
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2009-03-09 22:45:04 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2009-03-09 22:45:04 +0100
commit806e36d0d6a522f9b477cc1fa783da3c96742382 (patch)
tree9db8ad067def535fe0acc87a2d2dd7c89890f516 /portato/gui/windows
parent186255f9bc88d8558a85b992642a963199786193 (diff)
parent9bcef08ae6212926b0f8c04143e0c5ce4dae34b0 (diff)
downloadportato-806e36d0d6a522f9b477cc1fa783da3c96742382.tar.gz
portato-806e36d0d6a522f9b477cc1fa783da3c96742382.tar.bz2
portato-806e36d0d6a522f9b477cc1fa783da3c96742382.zip
Fix the IndexErrors for the jumping process for all cases
Diffstat (limited to 'portato/gui/windows')
-rw-r--r--portato/gui/windows/main.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index 5b3bf7e..103b792 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -1192,6 +1192,15 @@ class MainWindow (Window):
self.show_package(cp = cp, version = version, queue = self.queue)
+ def _jump_check_search (self, model, pos, elsef):
+ try:
+ row = model[pos]
+ except IndexError: # position not in model
+ debug("Position is too large for model")
+ return True
+ else:
+ return elsef(row)
+
def jump_to_pkg (self, name = None, pos = "0"):
if isinstance(pos, int):
pos = str(pos)
@@ -1200,7 +1209,7 @@ class MainWindow (Window):
model = self.pkgList.get_model()
if name:
- if model[pos][col] != name: # need to search :(
+ if self._jump_check_search(model, pos, lambda r: r[col] != name):
debug("Pkg path does not match. Searching...")
for cname, path in ((x[col], x.path) for x in model):
if cname == name:
@@ -1227,7 +1236,7 @@ class MainWindow (Window):
else:
sname = None
- if sname is None and model[pos][col] != name: # need to search in normal list
+ if sname is None and self._jump_check_search(model, pos, lambda r: r[col] != name): # need to search in normal list
debug("Cat path does not match. Searching...")
for cname, path in ((x[col], x.path) for x in model):
if cname == name:
@@ -1235,17 +1244,20 @@ class MainWindow (Window):
break
elif sname: # the collapse case
- row = model[pos.split(":")[0]]
+ p = pos.split(":")[0]
no_match = False
- if row[col] != sname[0]: # first part does not match :(
+
+ if self._jump_check_search(model, p, lambda r: r[col] != sname[0]):
debug("First part of cat path does not match. Searching...")
no_match = True
for r in model:
if r[col] == sname[0]:
row = r
break
+ else:
+ row = model[p]
- if no_match or model[pos][col] != sname[1]:
+ if no_match or self._jump_check_search(model, pos, lambda r: r[col] != sname[1]):
debug("Second part of cat path does not match. Searching...")
for cname, path in ((x[col], x.path) for x in row.iterchildren()):
if cname == sname[1]: # found second
er be changed. Add another xstrdup() when we assign environment variables to strings that are potentially non-constant. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> 2013-04-08Return const char * in cgit_{httpscheme, hosturl, rooturl}()Lukas Fleischer3-9/+9 The return values of these functions are essentially constant and should never be modified. Note that this will introduce a compiler warning when we try to free the return value of any of these functions. However, given that all of these currently return statically allocated strings in some cases, they need to be refactored before this can be done anyway. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> 2013-04-08Update git to v1.8.2.1John Keeping4-5/+6 This requires a small change to how we handle notes, but otherwise just works. Note that we can't use anything from v1.8.0 until v1.8.2.1 because some of the symbols that we need for graph drawing were made private in v1.8.0 and this was not reverted until v1.8.2.1. Signed-off-by: John Keeping <john@keeping.me.uk> 2013-04-07ui-blob: don't segfault when no path is givenJohn Keeping1-1/+1 It it possible to inspect blobs by specifying only the SHA-1, and CGit provides links to do so, for example if a tag points directly at a blob. In this case the path_items structure is never used, but creating it still causes strlen to be run on a null pointer. Fix this. This error was introduced by commit c1633c6 (Update git to v1.7.6.5 - 2013-03-02). Signed-off-by: John Keeping <john@keeping.me.uk> 2013-03-20Convert pager navigation into a unordered listLukas Fleischer3-9/+20 It is common practice and semantically appropriate to use unordered lists for long navigation lists. This also fixes the layout of very long pager navigations in Webkit-based browsers. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> 2013-03-20Makefile: remove CGIT-CFLAGS files in clean stageJason A. Donenfeld1-1/+1 2013-03-20ui-summary.c: Move urls variable into print_urls()Lukas Fleischer1-6/+14 There's no need for this variable to be global. Printing the header in print_urls() instead of print_url() allows for moving this variable into print_urls() without having to pass any status to print_url(). Note that this only works as long as we don't call print_urls() more than once. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> 2013-03-20Fix colspan valuesLukas Fleischer3-14/+28 This fixes a couple of minor oversights in previous commits and adjusts all cells using colspan to use the correct width. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> 2013-03-20html: check return value of writeJason A. Donenfeld1-2/+3 This squelches a gcc warning. It's also correct that we check to see if there are any partial or failed writes. For now, we just print a warning to stderr. In the future, perhaps it will prove wise to exit(1) on partial writes. 2013-03-20ui-shared: squelch compiler warning.Jason A. Donenfeld1-0/+1 Since tail is initialized to 0, we will never get a warning on the last if statement, but recent gcc complains anyway. So, we initialize len as well. Future gcc versions should be able to optimize this out anyway. 2013-03-20cgit.mk: Use SHELL_PATH_SQ to run gen-version.shJohn Keeping1-1/+1 On some platforms (notably Solaris) /bin/sh doesn't support enough of POSIX for gen-version.sh to run. Git's Makefile provides SHELL_PATH_SQ to address this issue so we just have to use it. Signed-off-by: John Keeping <john@keeping.me.uk> 2013-03-20cgit.mk: don't rebuild everything if CGIT_VERSION changesJohn Keeping1-1/+8 If CGIT_VERSION is in CGIT_CFLAGS then a change in version (for example because you have committed your changes) causes all of the CGit objects to be rebuilt. Avoid this by using EXTRA_CPPFLAGS to add the version for only those files that are affected and make them depend on VERSION. Signed-off-by: John Keeping <john@keeping.me.uk> 2013-03-20ui-patch: use cgit_version not CGIT_VERSIONJohn Keeping1-1/+1 We already have a global cgit_version which is set from the #define'd CGIT_VERSION in cgit.c. Change ui-patch.c to use this so that we only need to rebuild cgit.o when the version changes. Signed-off-by: John Keeping <john@keeping.me.uk> 2013-03-20Makefile: re-use Git's Makefile where possibleJohn Keeping3-119/+80 Git does quite a lot of platform-specific detection in its Makefile, which can result in it defining preprocessor variables that are used in its header files. If CGit does not define the same variables it can result in different sizes of some structures in different places in the same application. For example, on Solaris Git uses it's "compat" regex library which has a different sized regex_t structure than that available in the platform regex.h. This has a knock-on effect on the size of "struct rev_info" and leads to hard to diagnose runtime issues. In order to avoid all of this, introduce a "cgit.mk" file that includes Git's Makefile and make all of the existing logic apply to CGit's objects as well. This is slightly complicated because Git's Makefile must run in Git's directory, so all references to CGit files need to be prefixed with "../". In addition, OBJECTS is a simply expanded variable in Git's Makefile so we cannot just add our objects to it. Instead we must copy the two applicable rules into "cgit.mk". This has the advantage that we can split CGit-specific CFLAGS from Git's CFLAGS and hence avoid rebuilding all of Git whenever a CGit-specific value changes. Signed-off-by: John Keeping <john@keeping.me.uk> Acked-by: Jamie Couture <jamie.couture@gmail.com>