/* * Constructor */ public FindBar(PhotoQuery query, TreeModel model) : base(new HBox()) { this.query = query; box = Child as HBox; box.Spacing = 6; box.BorderWidth = 2; box.PackStart (new Label (Catalog.GetString ("Find:")), false, false, 0); entry = new Entry (); entry.Completion = new LogicEntryCompletion (entry, model); entry.TextInserted += HandleEntryTextInserted; entry.TextDeleted += HandleEntryTextDeleted; entry.KeyPressEvent += HandleEntryKeyPress; box.PackStart (entry, true, true, 0); Button clear_button = new Gtk.Button (); clear_button.Add (new Gtk.Image ("gtk-close", Gtk.IconSize.Button)); clear_button.Clicked += HandleCloseButtonClicked; clear_button.Relief = Gtk.ReliefStyle.None; box.PackStart (clear_button, false, false, 0); }
protected GroupAdaptor(PhotoQuery query) { this.query = query; this.query.Changed += HandleQueryChanged; Reload(); }
public async Task GetPhotosReturnsPhotosFromStoreTestAsync() { var profileId = Guid.NewGuid(); var photoReferences = Model.Create <List <Guid> >(); var photos = Model.Ignoring <Photo>(x => x.Data).Create <List <Photo> >(); var store = Substitute.For <IPhotoStore>(); var sut = new PhotoQuery(store); using (var tokenSource = new CancellationTokenSource()) { store.GetPhotos(profileId, tokenSource.Token).Returns(photoReferences); store.GetPhoto(profileId, Arg.Any <Guid>(), tokenSource.Token).Returns((CallInfo info) => { var photoId = info.ArgAt <Guid>(1); var index = photoReferences.IndexOf(photoId); return(photos[index]); }); var actual = await sut.GetPhotos(profileId, tokenSource.Token).ConfigureAwait(false); actual.Should().BeEquivalentTo(photos); } }
public RatingFilterDialog(PhotoQuery query, Gtk.Window parent_window) : base("RatingFilterDialog.ui", "rating_filter_dialog") { TransientFor = parent_window; DefaultResponse = ResponseType.Ok; ok_button.GrabFocus(); if (query.RatingRange != null) { minrating_value = (int)query.RatingRange.MinRating; maxrating_value = (int)query.RatingRange.MaxRating; } minrating = new RatingEntry(minrating_value); maxrating = new RatingEntry(maxrating_value); minrating_hbox.PackStart(minrating, false, false, 0); maxrating_hbox.PackStart(maxrating, false, false, 0); minrating.Show(); maxrating.Show(); minrating.Changed += HandleMinratingChanged; maxrating.Changed += HandleMaxratingChanged; var response = (ResponseType)Run(); if (response == ResponseType.Ok) { query.RatingRange = new RatingRange((uint)minrating.Value, (uint)maxrating.Value); } Destroy(); }
void ImportPhotos(PhotoQuery query, bool copy) { foreach (Photo p in query.Photos) { ImportPhoto(p, copy); } }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { if (Session["user"] != null && Request.QueryString["album"] != null) { PhotoQuery query = new PhotoQuery(PicasaQuery.CreatePicasaUri(((User)Session["user"]).Username, Request.QueryString["album"] as string)); PicasaService tmp = Session["service"] as PicasaService; PicasaFeed feed = tmp.Query(query); List <object> data = new List <object>(feed.Entries.Count); foreach (PicasaEntry entry in feed.Entries) { data.Add(new { name = entry.Title.Text, url = entry.Content.AbsoluteUri, }); } //this.Store1.T this.Store1.DataSource = data; this.Store1.DataBind(); } } }
private void GetPhotosFromAlbum(Album album) { int pageSize = 500; long pageCount = album.NumPhotos / pageSize; int currentPage = 0; int num = 0; Console.WriteLine("Album: {0} ({1})", album.Title, album.NumPhotos); while (currentPage <= pageCount) { PhotoQuery query = new PhotoQuery(PicasaQuery.CreatePicasaUri(this.Service.Credentials.Username, album.Id)); query.NumberToRetrieve = pageSize; query.StartIndex = currentPage * pageSize; query.ExtraParameters += "imgmax=d"; PicasaFeed feed = this.Service.Query(query); string destinationFolder = Path.Combine(this.DestinationRootPath, Utils.ScrubStringForFileSystem(album.Title)); foreach (PicasaEntry entry in feed.Entries) { Console.Write("\t [{0}/{1}]", num++.ToString("D4"), album.NumPhotos.ToString("D4")); DownloadPhotoDetails(entry, this.Service, destinationFolder); } currentPage++; } }
public FindBar(PhotoQuery query, TreeModel model) : base(new HBox()) { this.query = query; box = Child as HBox; box.Spacing = 6; box.BorderWidth = 2; box.PackStart(new Label(Strings.FindColon), false, false, 0); entry = new Entry(); entry.Completion = new LogicEntryCompletion(entry, model); entry.TextInserted += HandleEntryTextInserted; entry.TextDeleted += HandleEntryTextDeleted; entry.KeyPressEvent += HandleEntryKeyPress; box.PackStart(entry, true, true, 0); var clear_button = new Button(); clear_button.Add(new Image("gtk-close", IconSize.Button)); clear_button.Clicked += HandleCloseButtonClicked; clear_button.Relief = ReliefStyle.None; box.PackStart(clear_button, false, false, 0); }
protected GroupAdaptor (PhotoQuery query) { this.query = query; this.query.Changed += HandleQueryChanged; Reload (); }
public List <Photo> GetListFor(string albumId) { var service = new PicasaService("GPhotoSync"); service.SetAuthenticationToken(_credentials.AccessToken); var query = new PhotoQuery(PicasaQuery.CreatePicasaUri(_credentials.User, albumId)); query.ExtraParameters = "imgmax=d"; var feed = service.Query(query); if (feed != null) { var list = feed.Entries .OfType <PicasaEntry>() .Select(x => { var accessor = new PhotoAccessor(x); return(new Photo { Id = accessor.Id, Title = accessor.PhotoTitle, Path = x.Media.Content.Url }); }); return(list.OfType <Photo>().ToList()); } else { return(new List <Photo>()); } }
public void PhotoQueryConstructorTest() { string queryUri = "http://www.google.com/test"; string expected = "http://www.google.com/test?kind=photo"; PhotoQuery target = new PhotoQuery(queryUri); Assert.AreEqual(new Uri(expected), target.Uri); }
void HandleResponse(object obj, ResponseArgs args) { if (args.ResponseId == ResponseType.Accept) { PhotoQuery query = new PhotoQuery(from_db.Photos); query.RollSet = mdd.ActiveRolls == null ? null : new RollSet(mdd.ActiveRolls); DoMerge(query, mdd.ActiveRolls, mdd.Copy); } mdd.Dialog.Destroy(); }
public SimpleCalendar (PhotoQuery query) { this.parent_query = query; parent_query.Changed += ParentChanged; this.query = new PhotoQuery (parent_query.Store); this.query.Changed += Changed; ParentChanged (parent_query); this.Month = System.DateTime.Now; }
public SimpleCalendar(PhotoQuery query) { this.parent_query = query; parent_query.Changed += ParentChanged; this.query = new PhotoQuery(parent_query.Store); this.query.Changed += Changed; ParentChanged(parent_query); this.Month = System.DateTime.Now; }
void DoMerge(PhotoQuery query, Roll [] rolls, bool copy) { tag_map = new Dictionary <uint, Tag> (); roll_map = new Dictionary <uint, uint> (); Log.Warning("Merging tags"); MergeTags(from_db.Tags.RootCategory); Log.Warning("Creating the rolls"); CreateRolls(rolls); Log.Warning("Importing photos"); ImportPhotos(query, copy); }
public ContentQuery(GooglePhotosService service, DiscretePicasaAlbum album) { this.service = service; this.album = album; Picasa.Album picasaAlbum = new Picasa.Album(); picasaAlbum.AtomEntry = album.Entry; PhotoQuery picturesQuery = new PhotoQuery(PicasaQuery.CreatePicasaUri("default", picasaAlbum.Id)); picturesQuery.ExtraParameters = "imgmax=d"; PicasaFeed picturesFeed = service.PicasaService.Query(picturesQuery); picasaPictures = picturesFeed.Entries.OfType <PicasaEntry> ().ToArray(); }
public List <PicasaWebPhoto> QueryPhoto(BackgroundWorker worker, int overallJobPercent) { List <PicasaWebPhoto> retval = new List <PicasaWebPhoto>(); this.m_photoQuery = new PhotoQuery(PicasaQuery.CreatePicasaUri(this.m_userName, this.m_albumName)); this.m_photoService = new PicasaService(this.m_serviceName); //this.m_photoService.setUserCredentials(this.m_userName, this.m_password); this.m_photoService.SetAuthenticationToken(this.mUserToken); decimal count = ((decimal)overallJobPercent / 100) * 10; int smallCount = (int)count; worker.ReportProgress(0, (object)"Creating proxy"); CreatePhotoProxy(); try { worker.ReportProgress(smallCount, (object)"Proxy created"); worker.ReportProgress(0, (object)"Querying google"); this.m_photoFeed = this.m_photoService.Query(this.m_photoQuery); worker.ReportProgress(smallCount, (object)"Done"); if (this.m_photoFeed.Entries.Count > 0) { int percent = (int)Math.Round((decimal)((overallJobPercent - (smallCount * 2)) / this.m_photoFeed.Entries.Count), 0); worker.ReportProgress(0, (object)"Processing photo data"); foreach (PicasaEntry photo in this.m_photoFeed.Entries) { retval.Add(new PicasaWebPhoto(photo, this.m_albumName)); worker.ReportProgress(percent, null); } } } catch (Exception e) { this.m_photoQuery = null; this.m_photoService.RequestFactory = null; this.m_photoService = null; this.m_photoFeed = null; throw new Exception("Query Photo Exception", e); } this.m_photoQuery = null; this.m_photoService.RequestFactory = null; this.m_photoService = null; this.m_photoFeed = null; return(retval); }
private static string GetAlbum(string album) { string retVal; try { var service = new PicasaService("exampleCo-exampleApp-1"); string usr = Settings.GetSingleValue("Account") + "@gmail.com"; string pwd = Settings.GetSingleValue("Password"); service.setUserCredentials(usr, pwd); var query = new PhotoQuery(PicasaQuery.CreatePicasaUri(usr, album)); PicasaFeed feed = service.Query(query); retVal = "<ul id=\"AlbumList\">"; foreach (PicasaEntry entry in feed.Entries) { var firstThumbUrl = entry.Media.Thumbnails[0].Attributes["url"] as string; string thumGrp = "/s" + Settings.GetSingleValue("PicWidth") + "/"; if (firstThumbUrl != null) { firstThumbUrl = firstThumbUrl.Replace("/s72/", thumGrp); } var contentUrl = entry.Media.Content.Attributes["url"] as string; if (contentUrl != null) { contentUrl = contentUrl.Substring(0, contentUrl.LastIndexOf("/")); } contentUrl += "/s640/" + entry.Title.Text; retVal += string.Format(Img, firstThumbUrl, contentUrl); } retVal += "</ul>"; } catch (Exception qex) { retVal = qex.Message; } return(retVal); }
public LogicWidget(PhotoQuery query, TagStore tagStore) { //SetFlag (WidgetFlags.NoWindow); this.query = query; CanFocus = true; Sensitive = true; Init(); tagStore.ItemsChanged += HandleTagChanged; tagStore.ItemsRemoved += HandleTagDeleted; Show(); logic_widget = this; }
public Album GetAlbum(string albumID) { var query = new PhotoQuery(PicasaQuery.CreatePicasaUri(PicasaConfiguration.Settings.Gallery.User, albumID)) { Thumbsize = PicasaConfiguration.Settings.Pictures.ThumbnailSize.ToString(), ExtraParameters = PicasaConfiguration.Settings.Pictures.MaximumImageSize.HasValue ? ("imgmax=" + PicasaConfiguration.Settings.Pictures.MaximumImageSize.Value.ToString()) : "" }; var feed = GetPicasaFeed(query); return(new Album { Summary = PicasaDataMapper.MapPicasaAlbum(feed, albumID), Pictures = from PicasaEntry pictureEntry in feed.Entries select PicasaDataMapper.MapPicasaImage(pictureEntry) }); }
private static List <PhotoMessage> GetPhotos() { List <PhotoMessage> ans = new List <PhotoMessage>(); try { string fileName; Uri uriPath; WebClient HttpClient = new WebClient(); PhotoQuery query = new PhotoQuery(); query.Uri = new Uri(PhotoQuery.CreatePicasaUri("hagit.oded", "5780002529047522017")); PicasaService service = new PicasaService("PicasaAlbumDownloader"); PicasaFeed feed = (PicasaFeed)service.Query(query); Directory.SetCurrentDirectory("C:\\Photos\\"); foreach (AtomEntry aentry in feed.Entries) { uriPath = new Uri(aentry.Content.Src.ToString()); fileName = uriPath.LocalPath.Substring(uriPath.LocalPath.LastIndexOf('/') + 1); try { Console.WriteLine("Downloading: " + fileName); HttpClient.DownloadFile(aentry.Content.Src.ToString(), fileName); ans.Add(new PhotoMessage("C:\\Photos\\" + fileName)); } catch (WebException we) { try { HttpClient.DownloadFile(aentry.Content.Src.ToString(), fileName); ans.Add(new PhotoMessage("C:\\Photos\\" + fileName)); } catch (WebException we2) { Console.WriteLine(we2.Message); } } } } catch (Exception ex) { Console.Out.WriteLine(ex.Message); System.Diagnostics.EventLog.WriteEntry("WeddApp", ex.Message, System.Diagnostics.EventLogEntryType.Error, 626); } return(ans); }
public LogicWidget(PhotoQuery query, TagStore tagStore) { //SetFlag (WidgetFlags.NoWindow); this.query = query; CanFocus = true; Sensitive = true; Init (); tagStore.ItemsChanged += HandleTagChanged; tagStore.ItemsRemoved += HandleTagDeleted; Show (); logic_widget = this; }
public static PicasaEntry RetrievePicasaEntry(string id) { PicasaService service = new PicasaService(Picasa_APPLICATION_NAME); service.setUserCredentials(config.Username, config.Password); PhotoQuery photoQuery = new PhotoQuery(PicasaQuery.CreatePicasaUri(config.Username, string.Empty, id)); photoQuery.NumberToRetrieve = 1; PicasaFeed picasaFeed = service.Query(photoQuery); if (picasaFeed.Entries.Count > 0) { return((PicasaEntry)picasaFeed.Entries[0]); } return(null); }
#pragma warning restore 649 public LastRolls(PhotoQuery query, RollStore rollstore, Window parent) : base("LastImportRollFilterDialog.ui", "last_import_rolls_filter") { this.query = query; this.rollstore = rollstore; rolls = rollstore.GetRolls(Preferences.Get <int> (Preferences.IMPORT_GUI_ROLL_HISTORY)); TransientFor = parent; PopulateCombos(); combo_filter.Active = 0; combo_roll_1.Active = 0; combo_roll_2.Active = 0; DefaultResponse = ResponseType.Ok; Response += HandleResponse; Show(); }
public async Task GetPhotoReturnsPhotoFromStoreTest() { var expected = Model.Ignoring <Photo>(x => x.Data).Create <Photo>(); var store = Substitute.For <IPhotoStore>(); var sut = new PhotoQuery(store); using (var tokenSource = new CancellationTokenSource()) { store.GetPhoto(expected.ProfileId, expected.Id, tokenSource.Token).Returns(expected); var actual = await sut.GetPhoto(expected.ProfileId, expected.Id, tokenSource.Token) .ConfigureAwait(false); actual.Should().BeEquivalentTo(expected); } }
public void UploadPhotoTo(string albumId, string filename) { var service = new PicasaService("GPhotoSync"); service.SetAuthenticationToken(_credentials.AccessToken); var query = new PhotoQuery(PicasaQuery.CreatePicasaUri(_credentials.User, albumId)); var feed = service.Query(query); var media = new MediaFileSource(filename, MimeTypes.GetMimeType(Path.GetExtension(filename))); var photo = new PhotoEntry(); photo.Title = new AtomTextConstruct { Text = Path.GetFileNameWithoutExtension(filename) }; photo.MediaSource = media; service.Insert(feed, photo); }
protected virtual void Dispose(bool disposing) { if (!is_disposed) // only dispose once! { if (disposing) { m_albumService = null; m_albumFeed = null; m_albumQuery = null; m_photoService = null; m_photoQuery = null; m_photoFeed = null; m_userName = null; m_serviceName = null; m_albumName = null; } } this.is_disposed = true; }
public async Task GetPhotos() { // Arrange var options = new DbContextOptionsBuilder <MyAlbumDbContext>() .UseInMemoryDatabase(databaseName: "PhotoRepository_GetPhotos_MyAlbumDatabase") .Options; using (var context = new MyAlbumDbContext(options)) { IEnumerable <Photo> seedPhotos = SeedPhotos(context); PhotoRepository photoRepository = new PhotoRepository(context); PhotoQuery filter = new PhotoQuery(); // Act var photos = await photoRepository.GetPhotos(filter); // Assert Assert.Equal(seedPhotos, photos); } }
public List <PicasaWebPhoto> QueryPhoto(string tags) { List <PicasaWebPhoto> retval = new List <PicasaWebPhoto>(); GDataGAuthRequestFactory authFactory = new GDataGAuthRequestFactory("lh2", this.m_serviceName); authFactory.AccountType = "GOOGLE_OR_HOSTED"; this.m_photoQuery = new PhotoQuery(PicasaQuery.CreatePicasaUri(this.m_userName, this.m_albumName)); this.m_photoQuery.Tags = tags; this.m_photoService = new PicasaService(authFactory.ApplicationName); this.m_photoService.RequestFactory = authFactory; //this.m_photoService.setUserCredentials(this.m_userName, this.m_password); this.m_photoService.SetAuthenticationToken(this.mUserToken); CreatePhotoProxy(); try { this.m_photoFeed = this.m_photoService.Query(this.m_photoQuery); foreach (PicasaEntry photo in this.m_photoFeed.Entries) { retval.Add(new PicasaWebPhoto(photo, this.m_albumName)); } } catch (Exception e) { throw new Exception("Query Photo Exception", e); } finally { this.m_photoQuery = null; this.m_photoService.RequestFactory = null; this.m_photoService = null; this.m_photoFeed = null; } return(retval); }
public LogicWidget(PhotoQuery query, TagStore tag_store, TagSelectionWidget selector) : base() { //SetFlag (WidgetFlags.NoWindow); this.query = query; this.tag_selection_widget = selector; CanFocus = true; Sensitive = true; Literal.Tips = tips; tips.Enable(); Init(); tag_store.ItemsChanged += HandleTagChanged; tag_store.ItemsRemoved += HandleTagDeleted; Show(); logic_widget = this; }
/// <summary> /// Gets the photo list. /// </summary> /// <param name="feedUri">The feed URI.</param> /// <returns>Dictionary of photos.</returns> public Dictionary <string, Tuple <string, string> > GetPhotoList(string feedUri) { const int Medium = 1; Dictionary <string, Tuple <string, string> > photos = new Dictionary <string, Tuple <string, string> >(); PhotoQuery query = new PhotoQuery(feedUri) { ExtraParameters = "imgmax=1600" }; PicasaFeed picasaFeed = this.picasaService.Query(query); foreach (PicasaEntry x in picasaFeed.Entries) { string imageUrl = x.Media.Content.Url; string thumbnailUrl = x.Media.Thumbnails[Medium].Url; string imageTitle = x.Summary.Text; Tuple <string, string> photo = new Tuple <string, string>(thumbnailUrl, imageTitle); photos[imageUrl] = photo; } return(photos); }
/* * Constructor */ public FindBar(PhotoQuery query, TreeModel model) { this.query = query; Spacing = 6; PackStart(new Label(Catalog.GetString("Find:")), false, false, 0); entry = new Entry(); entry.Completion = new LogicEntryCompletion(entry, model); entry.TextInserted += HandleEntryTextInserted; entry.TextDeleted += HandleEntryTextDeleted; entry.KeyPressEvent += HandleEntryKeyPress; PackStart(entry, true, true, 0); Button clear_button = new Gtk.Button(); clear_button.Add(new Gtk.Image("gtk-close", Gtk.IconSize.Button)); clear_button.Clicked += HandleCloseButtonClicked; clear_button.Relief = Gtk.ReliefStyle.None; PackStart(clear_button, false, false, 0); }
public PhotoLoader (PhotoQuery query) { this.query = query; }
public QueryWidget(PhotoQuery query, Db db) : base(new HBox()) { box = Child as HBox; box.Spacing = 6; box.BorderWidth = 2; this.query = query; query.Changed += HandleChanged; label = new Gtk.Label (Catalog.GetString ("Find: ")); label.Show (); label.Ypad = 9; box.PackStart (label, false, false, 0); untagged = new Gtk.Label (Catalog.GetString ("Untagged photos")); untagged.Visible = false; box.PackStart (untagged, false, false, 0); comma1_label = new Gtk.Label (", "); comma1_label.Visible = false; box.PackStart (comma1_label, false, false, 0); rated = new Gtk.Label (Catalog.GetString ("Rated photos")); rated.Visible = false; box.PackStart (rated, false, false, 0); comma2_label = new Gtk.Label (", "); comma2_label.Visible = false; box.PackStart (comma2_label, false, false, 0); // Note for translators: 'Import roll' is no command, it means 'Roll that has been imported' rollfilter = new Gtk.Label (Catalog.GetString ("Import roll")); rollfilter.Visible = false; box.PackStart (rollfilter, false, false, 0); folder_query_widget = new FolderQueryWidget (query); folder_query_widget.Visible = false; box.PackStart (folder_query_widget, false, false, 0); logic_widget = new LogicWidget (query, db.Tags); logic_widget.Show (); box.PackStart (logic_widget, true, true, 0); warning_box = new Gtk.HBox (); warning_box.PackStart (new Gtk.Label (System.String.Empty)); Gtk.Image warning_image = new Gtk.Image ("gtk-info", Gtk.IconSize.Button); warning_image.Show (); warning_box.PackStart (warning_image, false, false, 0); clear_button = new Gtk.Button (); clear_button.Add (new Gtk.Image ("gtk-close", Gtk.IconSize.Button)); clear_button.Clicked += HandleClearButtonClicked; clear_button.Relief = Gtk.ReliefStyle.None; clear_button.TooltipText = Catalog.GetString("Clear search"); box.PackEnd (clear_button, false, false, 0); refresh_button = new Gtk.Button (); refresh_button.Add (new Gtk.Image ("gtk-refresh", Gtk.IconSize.Button)); refresh_button.Clicked += HandleRefreshButtonClicked; refresh_button.Relief = Gtk.ReliefStyle.None; refresh_button.TooltipText = Catalog.GetString("Refresh search"); box.PackEnd (refresh_button, false, false, 0); Gtk.Label warning = new Gtk.Label (Catalog.GetString ("No matching photos found")); warning_box.PackStart (warning, false, false, 0); warning_box.ShowAll (); warning_box.Spacing = 6; warning_box.Visible = false; box.PackEnd (warning_box, false, false, 0); warning_box.Visible = false; }
public EditTagIconDialog(Db db, Tag t, Gtk.Window parent_window) : base("EditTagIconDialog.ui", "edit_tag_icon_dialog") { TransientFor = parent_window; Title = String.Format(Catalog.GetString("Edit Icon for Tag {0}"), t.Name); preview_pixbuf = t.Icon; Cms.Profile screen_profile; if (preview_pixbuf != null && ColorManagement.Profiles.TryGetValue(Preferences.Get <string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile)) { preview_image.Pixbuf = preview_pixbuf.Copy(); ColorManagement.ApplyProfile(preview_image.Pixbuf, screen_profile); } else { preview_image.Pixbuf = preview_pixbuf; } query = new PhotoQuery(db.Photos); if (db.Tags.Hidden != null) { query.Terms = OrTerm.FromTags(new [] { t }); } else { query.Terms = new Literal(t); } image_view = new PhotoImageView(query) { CropHelpers = false }; image_view.SelectionXyRatio = 1.0; image_view.SelectionChanged += HandleSelectionChanged; image_view.PhotoChanged += HandlePhotoChanged; external_photo_chooser = new Gtk.FileChooserButton(Catalog.GetString("Select Photo from file"), Gtk.FileChooserAction.Open); external_photo_chooser.Filter = new FileFilter(); external_photo_chooser.Filter.AddPixbufFormats(); external_photo_chooser.LocalOnly = false; external_photo_chooser_hbox.PackStart(external_photo_chooser); external_photo_chooser.Show(); external_photo_chooser.SelectionChanged += HandleExternalFileSelectionChanged; photo_scrolled_window.Add(image_view); if (query.Count > 0) { photo_spin_button.Wrap = true; photo_spin_button.Adjustment.Lower = 1.0; photo_spin_button.Adjustment.Upper = (double)query.Count; photo_spin_button.Adjustment.StepIncrement = 1.0; photo_spin_button.ValueChanged += HandleSpinButtonChanged; image_view.Item.Index = 0; } else { from_photo_label.Markup = String.Format(Catalog.GetString( "\n<b>From Photo</b>\n" + " You can use one of your library photos as an icon for this tag.\n" + " However, first you must have at least one photo associated\n" + " with this tag. Please tag a photo as '{0}' and return here\n" + " to use it as an icon."), t.Name); photo_scrolled_window.Visible = false; photo_label.Visible = false; photo_spin_button.Visible = false; } icon_store = new ListStore(typeof(string), typeof(Gdk.Pixbuf)); icon_view = new Gtk.IconView(icon_store); icon_view.PixbufColumn = 1; icon_view.SelectionMode = SelectionMode.Single; icon_view.SelectionChanged += HandleIconSelectionChanged; icon_scrolled_window.Add(icon_view); icon_view.Show(); image_view.Show(); DelayedOperation fill_delay = new DelayedOperation(FillIconView); fill_delay.Start(); }
public EditTagIconDialog(Db db, Tag t, Gtk.Window parent_window) : base("EditTagIconDialog.ui", "edit_tag_icon_dialog") { TransientFor = parent_window; Title = String.Format (Catalog.GetString ("Edit Icon for Tag {0}"), t.Name); preview_pixbuf = t.Icon; Cms.Profile screen_profile; if (preview_pixbuf != null && ColorManagement.Profiles.TryGetValue (Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile)) { preview_image.Pixbuf = preview_pixbuf.Copy (); ColorManagement.ApplyProfile (preview_image.Pixbuf, screen_profile); } else preview_image.Pixbuf = preview_pixbuf; query = new PhotoQuery (db.Photos); if (db.Tags.Hidden != null) query.Terms = OrTerm.FromTags (new [] {t}); else query.Terms = new Literal (t); image_view = new PhotoImageView (query) {CropHelpers = false}; image_view.SelectionXyRatio = 1.0; image_view.SelectionChanged += HandleSelectionChanged; image_view.PhotoChanged += HandlePhotoChanged; external_photo_chooser = new Gtk.FileChooserButton (Catalog.GetString ("Select Photo from file"), Gtk.FileChooserAction.Open); external_photo_chooser.Filter = new FileFilter(); external_photo_chooser.Filter.AddPixbufFormats(); external_photo_chooser.LocalOnly = false; external_photo_chooser_hbox.PackStart (external_photo_chooser); external_photo_chooser.Show (); external_photo_chooser.SelectionChanged += HandleExternalFileSelectionChanged; photo_scrolled_window.Add (image_view); if (query.Count > 0) { photo_spin_button.Wrap = true; photo_spin_button.Adjustment.Lower = 1.0; photo_spin_button.Adjustment.Upper = (double) query.Count; photo_spin_button.Adjustment.StepIncrement = 1.0; photo_spin_button.ValueChanged += HandleSpinButtonChanged; image_view.Item.Index = 0; } else { from_photo_label.Markup = String.Format (Catalog.GetString ( "\n<b>From Photo</b>\n" + " You can use one of your library photos as an icon for this tag.\n" + " However, first you must have at least one photo associated\n" + " with this tag. Please tag a photo as '{0}' and return here\n" + " to use it as an icon."), t.Name); photo_scrolled_window.Visible = false; photo_label.Visible = false; photo_spin_button.Visible = false; } icon_store = new ListStore (typeof (string), typeof (Gdk.Pixbuf)); icon_view = new Gtk.IconView (icon_store); icon_view.PixbufColumn = 1; icon_view.SelectionMode = SelectionMode.Single; icon_view.SelectionChanged += HandleIconSelectionChanged; icon_scrolled_window.Add (icon_view); icon_view.Show(); image_view.Show (); DelayedOperation fill_delay = new DelayedOperation (FillIconView); fill_delay.Start (); }
public PhotoLoader(PhotoQuery query) { this.query = query; }
public LogicWidget (PhotoQuery query, TagStore tag_store, TagSelectionWidget selector) : base () { //SetFlag (WidgetFlags.NoWindow); this.query = query; this.tag_selection_widget = selector; CanFocus = true; Sensitive = true; Literal.Tips = tips; tips.Enable (); Init (); tag_store.ItemsChanged += HandleTagChanged; tag_store.ItemsRemoved += HandleTagDeleted; Show (); logic_widget = this; }