Commits

Anonymous committed 778ad04

Added Update dialog, and updated the Preferences dialog with options for Microbloging services

Comments (0)

Files changed (1)

 
 		self.url_entry = gtk.Entry()
 		self.url_entry.modify_text(gtk.STATE_NORMAL, gtk.gdk.color_parse("blue"))
-		fonturl = 'sans unicode 16'
+		fonturl = 'serif,monospace unicode 16'
 		fonturl_desc = pango.FontDescription(fonturl)
 		self.url_entry.modify_font(fonturl_desc)
 		self.url_entry.connect("activate", self.on_short_url)
 		about_dialog.destroy()
 
 	def post_to_update(self, widget):
-		pass
+		updatedialog = gtk.Dialog(None, None, gtk.DIALOG_MODAL)
+		updatedialog.set_title("pyBit Status update")
+		updatedialog.set_resizable(False)
+		updatedialog.set_size_request(300, 150)
+		self.upbuff = gtk.TextBuffer()
+		uptext = gtk.TextView()
+		uptext.set_wrap_mode(gtk.WRAP_WORD)
+		uptext.set_buffer(self.upbuff)
+		updatedialog.vbox.pack_start(uptext, True)
+
+		updatedialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
+		updatedialog.add_button(gtk.STOCK_EXECUTE, gtk.RESPONSE_ACCEPT)
+
+		upbutt = gtk.Button(stock=gtk.STOCK_PASTE)
+		upbutt.connect("clicked", self.on_status_paste)
+
+		updatedialog.action_area.pack_end(upbutt)
+
+		updatedialog.show_all()
+		response = updatedialog.run()
+		if response == gtk.RESPONSE_CLOSE:
+			updatedialog.destroy()
+		elif response == gtk.RESPONSE_ACCEPT:
+			print self.upbuff.get_text(self.upbuff.get_start_iter(), self.upbuff.get_end_iter())
+			updatedialog.destroy()
+
+	def on_status_paste(self, widget):
+		self.upbuff.insert_at_cursor(self.result_entry.get_text())
+
 
 	def clear_entries(self, widget):
 		self.url_entry.set_text("")
 		px = gtk.CellRendererPixbuf()
 		text = gtk.CellRendererText()
 		prefcomb.pack_start(px, False)
-		prefcomb.pack_end(text, False)
+		prefcomb.pack_start(text, False)
 		prefcomb.add_attribute(px, "pixbuf", 0)
 		prefcomb.add_attribute(text, "text", 1)
 		prefcomb.set_model(preflist)
 		prefhb3.pack_start(preflb3)
 		prefhb3.pack_start(prefent2)
 
+		preflb4 = gtk.Label()
+		preflb4.set_markup("<b>Status update site: </b>\t\t ")
+		pref_update_comb = gtk.ComboBox()
+		pref_update_list = gtk.ListStore(gtk.gdk.Pixbuf, str)
+		pref_update_comb.pack_start(px, False)
+		pref_update_comb.pack_start(text, False)
+		pref_update_comb.add_attribute(px, "pixbuf", 0)
+		pref_update_comb.add_attribute(text, "text", 1)
+		pref_update_comb.set_model(pref_update_list)
+		twitimg = gtk.gdk.pixbuf_new_from_file("icons/favs/twitter.png")
+		pref_update_list.append((twitimg, "Twitter"))
+		identimg = gtk.gdk.pixbuf_new_from_file("icons/favs/identica.png")
+		pref_update_list.append((identimg, "Identi.ca"))
+		pref_update_comb.set_active(0)
+		prefhb4 = gtk.HBox()
+		prefhb4.pack_start(preflb4)
+		prefhb4.pack_start(pref_update_comb)
+
+		preflb5 = gtk.Label()
+		preflb5.set_markup("<b>Username:</b> (required)")
+		prefent3 = gtk.Entry()
+		prefhb5 = gtk.HBox()
+		prefhb5.pack_start(preflb5)
+		prefhb5.pack_start(prefent3)
+
+		preflb6 = gtk.Label()
+		preflb6.set_markup("<b>Password:</b> (required) ")
+		prefent4 = gtk.Entry()
+		prefent4.set_visibility(False)
+		prefhb6 = gtk.HBox()
+		prefhb6.pack_start(preflb6)
+		prefhb6.pack_start(prefent4)
+
+		prefsp = gtk.HSeparator()
+		
 
 		prefdialog.vbox.pack_start(prefhb1)
 		prefdialog.vbox.pack_start(prefhb2)
 		prefdialog.vbox.pack_start(prefhb3)
+		prefdialog.vbox.pack_start(prefsp)
+		prefdialog.vbox.pack_start(prefhb4)
+		prefdialog.vbox.pack_start(prefhb5)
+		prefdialog.vbox.pack_start(prefhb6)
 
 		prefdialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CANCEL)
 		prefdialog.add_button(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT)
 	def paste_from_clipboard(self, widget):
 		"""docstring for paste_from_clipboard"""
 		try:
-			clipboard = gtk.clipboard_get("PRIMARY")
+			clipboard = gtk.clipboard_get("CLIPBOARD")
 			if clipboard.wait_is_text_available() == True:
 				cliptext = clipboard.wait_for_text()
 				if re.match(URL_CHECK, cliptext):