~ubuntu-branches/ubuntu/lucid/gwibber/lucid-proposed

« back to all changes in this revision

Viewing changes to gwibber/gwui.py

  • Committer: Bazaar Package Importer
  • Author(s): Ken VanDine, Ken VanDine, Didier Roche
  • Date: 2010-02-17 14:47:15 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20100217144715-emnd56aqicc3hone
Tags: 2.29.90-0ubuntu1
[ Ken VanDine ]
* New upstream release 2.29.90
  - ported Qaiku, StatusNet and Digg to 2.29.x
  - Added logging, now outputs logs in $HOME/.cache/gwibber/
  - Added url shortening to the python API
  - Updated docstrings for epydoc friendly API docs

[ Didier Roche ]
* debian/control:
  - bump Standard-Version

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
      "color": None,
96
96
    })
97
97
 
98
 
    for stream in ["messages", "replies", "private"]:
 
98
    for stream in ["messages", "replies", "images", "private"]:
99
99
      items.append({
100
100
        "name": stream.capitalize(),
101
101
        "stream": stream,
245
245
    template = open(template_path).read()
246
246
    template = Template(template, lookup=TemplateLookup(directories=lookup_paths))
247
247
    content = template.render(theme=util.get_theme_colors(), resources=resources, _=_, **kwargs)
 
248
 
 
249
    # Avoid navigation redraw crashes
 
250
    if isinstance(self, Navigation) and not self.get_property("visible"):
 
251
      return content
248
252
    
249
253
    self.load_html_string(content, "file://%s/" % os.path.dirname(template_path))
250
254
    return content
327
331
    self.splitter.add1(self.navigation_scroll)
328
332
    self.splitter.add2(layout)
329
333
    
330
 
    self.splitter.set_position(40)
 
334
    self.splitter.set_position(self.model.settings["sidebar_splitter"])
 
335
    self.handle_splitter_position_change(self.model.settings["sidebar_splitter"])
331
336
    self.splitter.connect("notify", self.on_splitter_drag)
332
337
 
333
338
    self.pack_start(self.splitter, True)
334
339
 
 
340
  def handle_splitter_position_change(self, pos):
 
341
    if pos < 70 and self.navigation.tree_enabled:
 
342
      #self.navigation_scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)
 
343
      self.navigation_scroll.set_shadow_type(gtk.SHADOW_NONE)
 
344
      self.navigation.tree_enabled = False
 
345
      self.navigation.render()
 
346
 
 
347
    if pos > 70 and not self.navigation.tree_enabled:
 
348
      #self.navigation_scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER)
 
349
      self.navigation_scroll.set_shadow_type(gtk.SHADOW_IN)
 
350
      self.navigation.tree_enabled = True
 
351
      self.navigation.render()
 
352
 
 
353
    if pos < 30 and not self.navigation.small_icons:
 
354
      self.navigation.small_icons = True
 
355
      self.navigation.render()
 
356
 
 
357
    if pos > 30 and self.navigation.small_icons:
 
358
      self.navigation.small_icons = False
 
359
      self.navigation.render()
 
360
 
 
361
    if pos < 25:
 
362
      self.splitter.set_position(25)
 
363
 
335
364
  def on_splitter_drag(self, pane, ev):
336
365
    if ev.name == 'position':
337
366
      pos = pane.get_position()
 
367
      self.handle_splitter_position_change(pos)      
338
368
      
339
 
      if pos < 70 and self.navigation.tree_enabled:
340
 
        #self.navigation_scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)
341
 
        self.navigation_scroll.set_shadow_type(gtk.SHADOW_NONE)
342
 
        self.navigation.tree_enabled = False
343
 
        self.navigation.render()
344
 
 
345
 
      if pos > 70 and not self.navigation.tree_enabled:
346
 
        #self.navigation_scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER)
347
 
        self.navigation_scroll.set_shadow_type(gtk.SHADOW_IN)
348
 
        self.navigation.tree_enabled = True
349
 
        self.navigation.render()
350
 
 
351
 
      if pos < 30 and not self.navigation.small_icons:
352
 
        self.navigation.small_icons = True
353
 
        self.navigation.render()
354
 
 
355
 
      if pos > 30 and self.navigation.small_icons:
356
 
        self.navigation.small_icons = False
357
 
        self.navigation.render()
358
 
 
359
 
      if pos < 25:
360
 
        self.splitter.set_position(25)
361
 
 
362
369
  def on_stream_closed(self, widget, id, kind):
363
370
    self.emit("stream-closed", id, kind)
364
371
 
431
438
  def on_action(self, widget, uri, cmd, query):
432
439
    self.emit("action", uri, cmd, query)
433
440
 
434
 
  def new_stream(self, state=None):
 
441
  def new_stream(self, state={"stream": "messages", "account": None}):
435
442
    item = MultiStreamPane(self.model)
436
443
    item.set_property("width-request", 350)
437
444
    item.connect("search", self.on_search)
466
473
 
467
474
  def __init__(self, model):
468
475
    gtk.VBox.__init__(self, spacing = 2)
469
 
    self.model = Model()
 
476
    self.model = model
470
477
    self.selected_stream = None
471
478
 
472
479
    # Build the top navigation bar
542
549
    navigation.selected_stream = self.selected_stream
543
550
    navigation.tree_enabled = True
544
551
    navigation.small_icons = True
 
552
    navigation.show()
545
553
    navigation.render()
546
554
 
547
555
    window.add(navigation)
781
789
  def __init__(self):
782
790
    gtk.TextView.__init__(self)
783
791
    self.drawable = None
784
 
 
785
792
    self.model = Model()
786
793
 
787
794
    self.overlay_color = util.get_theme_colors()["text"].darker(3).hex
796
803
    self.get_buffer().connect("insert-text", self.on_add_text)
797
804
    self.get_buffer().connect("changed", self.on_text_changed)
798
805
    self.connect("expose-event", self.expose_view)
 
806
    self.connect("size-allocate", self.on_size_allocate)
799
807
 
800
808
    # set properties
801
809
    self.set_border_width(0)
842
850
  def set_overlay_text(self, text):
843
851
    self.pango_overlay.set_markup(self.overlay_text % (self.overlay_color, text))
844
852
 
 
853
  def on_size_allocate(self, *args):
 
854
    if self.drawable: self.drawable.show()
 
855
 
845
856
  def expose_view(self, window, event):
846
857
    if not self.drawable:
847
858
      self.drawable = self.get_window(gtk.TEXT_WINDOW_TEXT)
848
859
      self.pango_overlay = self.create_pango_layout("")
849
860
      self.set_overlay_text(140)
850
 
      
 
861
 
851
862
    gc = self.drawable.new_gc()
852
863
    ww, wh = self.drawable.get_size()
853
864
    tw, th = self.pango_overlay.get_pixel_size()
854
 
    self.drawable.draw_layout(gc, ww - tw, wh - th, self.pango_overlay)
 
865
    self.drawable.draw_layout(gc, ww - tw - 2, wh - th, self.pango_overlay)
855
866
 
856
867
  def on_text_changed(self, w):
857
868
    chars = self.get_char_count()