Example #1
0
	def locate_zotero(self, event = None):
		
		"""
		Presents a simple preference dialog.
		Currently, this is simply a locate dialog for the Zotero folfer.
		"""
		
		fd = gtk.FileChooserDialog("Locate Zotero Folder", None, gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK))
		if fd.run() == gtk.RESPONSE_OK:
			self.zotero_folder = fd.get_filename()
			
			print "gnoter_base.locate_zotero(): selected %s" % self.zotero_folder
			
			if libzotero.valid_location(self.zotero_folder):
				print "gnoter_base.locate_zotero(): path ok"
				self.zotero = libzotero.libzotero(self.zotero_folder)
			else:
				print "gnoter_base.locate_zotero(): path not ok"
				fd.destroy()
				mb = gtk.MessageDialog(buttons=gtk.BUTTONS_OK)
				mb.set_title("Oops!")
				mb.set_markup("<b>I could not find zotero.sqlite in this folder</b>\n\nYou can find the Zotero folder in the Advanced section of your Zotero preferences.\n\nPlease try again.")
				mb.run()
				mb.destroy()
				self.locate_zotero()
				return
		else:
			self.messagebox("Cancelled", "You have pressed cancel, exiting Gnotero...")
			quit()				
		
		fd.destroy()
Example #2
0
    def save_and_destroy(self, widget):

        if not libzotero.valid_location(
                self.zotero_folder_input.get_filename()):
            mb = gtk.MessageDialog(buttons=gtk.BUTTONS_OK)
            mb.set_title("Incorrect folder")
            mb.set_markup(
                "<b>Incorrect folder. Please select the Zotero Data folder</b>\n\nYou can find this folder in the Advanced section of your Zotero preferences."
            )
            mb.run()
            mb.destroy()
            return

        if self.checkbutton_gnote.get_active():
            self.notes = "gnote"
        else:
            self.notes = "disabled"

        if self.checkbutton_live_search.get_active():
            self.enable_live_search = "yes"
        else:
            self.enable_live_search = "no"

        if self.checkbutton_clipboard.get_active():
            self.use_clipboard = "yes"
        else:
            self.use_clipboard = "no"

        if self.checkbutton_attach.get_active():
            self.attach_menu_to_icon = "yes"
        else:
            self.attach_menu_to_icon = "no"

        self.window_pos_x = 0.01 * self.spinbutton_hpos.get_value_as_int()
        self.window_pos_y = 0.01 * self.spinbutton_vpos.get_value_as_int()

        self.zotero_folder = self.zotero_folder_input.get_current_folder()
        self.sync_path = self.sync_path_input.get_current_folder()
        self.sync_name = self.sync_name_input.get_text()

        if self.checkbutton_icon_tango.get_active():
            self.systray_icon = self.checkbutton_icon_tango.icon
        if self.checkbutton_icon_light.get_active():
            self.systray_icon = self.checkbutton_icon_light.icon
        if self.checkbutton_icon_dark.get_active():
            self.systray_icon = self.checkbutton_icon_dark.icon

        self.save_config()

        mb = gtk.MessageDialog(buttons=gtk.BUTTONS_OK)
        mb.set_title("Please restart gnotero")
        mb.set_markup(
            "<b>Your configuration has been saved</b>\n\nPlease restart any open instances of gnotero, gnoterobrowse and gnoteroconf."
        )
        mb.run()
        mb.destroy()

        self.destroy(widget)
Example #3
0
	def save_and_destroy(self, widget):
	
		if not libzotero.valid_location(self.zotero_folder_input.get_filename()):
			mb = gtk.MessageDialog(buttons=gtk.BUTTONS_OK)
			mb.set_title("Incorrect folder")
			mb.set_markup("<b>Incorrect folder. Please select the Zotero Data folder</b>\n\nYou can find this folder in the Advanced section of your Zotero preferences.")
			mb.run()
			mb.destroy()
			return				
		
		if self.checkbutton_gnote.get_active():
			self.notes = "gnote"
		else:
			self.notes = "disabled"			
			
		if self.checkbutton_live_search.get_active():
			self.enable_live_search = "yes"
		else:
			self.enable_live_search = "no"		
			
		if self.checkbutton_clipboard.get_active():
			self.use_clipboard = "yes"
		else:
			self.use_clipboard = "no"	
			
		if self.checkbutton_attach.get_active():
			self.attach_menu_to_icon = "yes"
		else:
			self.attach_menu_to_icon = "no"
			
		self.window_pos_x = 0.01 * self.spinbutton_hpos.get_value_as_int()
		self.window_pos_y = 0.01 * self.spinbutton_vpos.get_value_as_int()
			
		self.zotero_folder = self.zotero_folder_input.get_current_folder()
		self.sync_path = self.sync_path_input.get_current_folder()
		self.sync_name = self.sync_name_input.get_text()	
		
		if self.checkbutton_icon_tango.get_active():
			self.systray_icon = self.checkbutton_icon_tango.icon
		if self.checkbutton_icon_light.get_active():
			self.systray_icon = self.checkbutton_icon_light.icon
		if self.checkbutton_icon_dark.get_active():
			self.systray_icon = self.checkbutton_icon_dark.icon

	
		self.save_config()
		
		mb = gtk.MessageDialog(buttons=gtk.BUTTONS_OK)
		mb.set_title("Please restart gnotero")
		mb.set_markup("<b>Your configuration has been saved</b>\n\nPlease restart any open instances of gnotero, gnoterobrowse and gnoteroconf.")
		mb.run()
		mb.destroy()		
		
		self.destroy(widget)
Example #4
0
    def locate_zotero(self, event=None):
        """
		Presents a simple preference dialog.
		Currently, this is simply a locate dialog for the Zotero folfer.
		"""

        fd = gtk.FileChooserDialog("Locate Zotero Folder", None,
                                   gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
                                   (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                    gtk.STOCK_OPEN, gtk.RESPONSE_OK))
        if fd.run() == gtk.RESPONSE_OK:
            self.zotero_folder = fd.get_filename()

            print "gnoter_base.locate_zotero(): selected %s" % self.zotero_folder

            if libzotero.valid_location(self.zotero_folder):
                print "gnoter_base.locate_zotero(): path ok"
                self.zotero = libzotero.libzotero(self.zotero_folder)
            else:
                print "gnoter_base.locate_zotero(): path not ok"
                fd.destroy()
                mb = gtk.MessageDialog(buttons=gtk.BUTTONS_OK)
                mb.set_title("Oops!")
                mb.set_markup(
                    "<b>I could not find zotero.sqlite in this folder</b>\n\nYou can find the Zotero folder in the Advanced section of your Zotero preferences.\n\nPlease try again."
                )
                mb.run()
                mb.destroy()
                self.locate_zotero()
                return
        else:
            self.messagebox("Cancelled",
                            "You have pressed cancel, exiting Gnotero...")
            quit()

        fd.destroy()