SPF Index du Forum
 Accueil    FAQ    Rechercher
 Connexion

Home -> PointUI dans tous ses états


Applet Today (Aujourd'hui)
Montecristoff
Posté le: 12/02/2009 15:58

Sujet ouvert pour accueillir toutes les adaptations ou modifications de l' Applet Today (Aujourd'hui)

...

Cool

Répondre en citant  |   | Revenir en haut de page  | 
atthalinf
Posté le: 15/02/2009 23:17

Montecristoff a écrit:
Sujet ouvert pour accueillir toutes les adaptations ou modifications de l' Applet Today (Aujourd'hui)

...

8)


#1 Posté le: Aujourd'hui à 23:08 Sujet du message: Modifier le lien vers l'explorer internet

--------------------------------------------------------------------------------

Bonsoir

Dans l'applet ToDay lorsque je pointe sur la barre Google en bas qui me propose l'accés à divers flux c'est OPERA Beta qui se lance
Or il a tendant a faire 'Out of <memory'
Est il possible de paramétrer le lien pour aller vers un autre explorer : Opera mini ou simplement Explorer

je chereche depuis 2 jours en vain

Merci pour ce beau produit

Répondre en citant  |   | Revenir en haut de page  | 
ManQ1 Nephrite 218DA8
Posté le: 18/02/2009 01:43

Ey voila le mode FR


//Pointui C Script
/*
COPYRIGHT

Copyright (c) 2008-2009 Pointui Pty Ltd, All Rights Reserved.
ABN: 80 129 073 678

This software is provided under license by Pointui Pty Ltd, and use thereof is subject to
the licensing terms. Distribution of this software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND.
This software is protected by Australian and international law. This software program may not be reproduced, transmitted,
or disclosed to third parties, in whole or in part, in any form or by any manner, electronic or mechanical, without the
express written consent of Pointui Pty Ltd, except to the extent provided for by applicable license.
*/

#region Applet
class TodayApplet : Applet
{

//Label lblDebug, lblDebug1;

Control ctlAppointments;

RegistryNotification time;

Image imgBackground;

Button btnTabToday, btnTabTomorrow;
Label lblToday, lblTomorrow;

DateTime dt;
Label lblDate;
Label lblForecast;

Label lblCurrentTemp;

bool IsTomorrow;

HttpFetch weatherRssFetch;
XmlNode root, cities, currentCity, weatherImages;
String currentCityName;
String currentCityID;
String weatherUrl;
String weatherFilename;
String weatherReport;
Image imgWeatherIcon1, imgWeatherIcon2;
Image imgWeatherProvider;
Timer weatherUpdateTimer;


HttpFetch newsRssFetch;
String newsUrl;
String newsFilename;
String newsReport;
Label lblNews1, lblNews2;
Image imgNewsProvider;
Timer newsUpdateTimer;
bool isNewsUpdateTimerActive;
XmlNode newsRoot;

int newsFirstItemIndex; // First <item> containing a headline
int newsLastItemIndex; // Last <item> containing a headline
int newsHeadlineIndex; // <item> containing current headline
bool newsIsLabel1; // Determines which label gets the next headline
String urlFullStory; // Link to the full story

int leftColWidth, rightColWidth;
int contentTop;

int updateIntervalMinutes;
DateTime dtLastUpdate;

WaitCursor cursor;

#region Load
void Load()
{
int y, x;
y = 0;
x = 0;

IsTomorrow = false;
int Pos_x, Pos_y;

String st;

// Load the Left tab image
btnTabToday.ImageSelected.LoadFromFile("Tab.Left.Selected.jif");
btnTabToday.Image.LoadFromFile("Tab.Left.jif");
Controls.Add(btnTabToday);
btnTabToday.SetBounds(0, 0);
btnTabToday.OnClick = btnTabToday_OnClick;
// btnTabToday.OnClick = btnTab_OnClick;
btnTabToday.SetSelected(true);

x = btnTabToday.Image.GetWidth();
y = btnTabToday.Image.GetHeight();

// Add the background image
imgBackground.Surface.LoadFromFile("Background.jif");
Controls.Add(imgBackground);
imgBackground.SetBounds(0, y);
imgBackground.SetTabStop(true); // Needed to stop mouse clicks from going through to underlying control
imgBackground.OnClick = imgBackground_OnClick;

x = btnTabToday.Image.GetWidth();
y = btnTabToday.Image.GetHeight() - (btnTabToday.Image.GetHeight() / 6);

// Load the Right tag image
btnTabTomorrow.Image.LoadFromFile("Tab.Right.jif");
btnTabTomorrow.ImageSelected.LoadFromFile("Tab.Right.Selected.jif");
//btnTabTomorrow.ImageSelected.LoadFromFile("Icon.Sun.jif");
Controls.Add(btnTabTomorrow);
btnTabTomorrow.SetBounds(x, 0);
// btnTabTomorrow.OnClick = btnTab_OnClick;
btnTabTomorrow.OnClick = btnTabTomorrow_OnClick;


// Stick a label on the Left tab
Controls.Add(lblToday, btnTabToday);
lblToday.SetAlign("Center", "Bottom");
lblToday.SetFont("Font.Title");
lblToday.SetBounds(0, 0, x, y);
//lblToday.SetText("Aujourd hui ");

// Stick a label on the Right tab
Controls.Add(lblTomorrow, btnTabTomorrow); // Attempt to make it a child of the 'tomorrow' button
lblTomorrow.SetAlign("Center", "Bottom");
lblTomorrow.SetFont("Font.Large");
lblTomorrow.SetBounds(x + 1, 0, x, y);
lblTomorrow.SetText("Demain ");

// Add the weather provider image
imgWeatherProvider.Surface.LoadFromFile("Logo.Weather.Provider.jif");
Controls.Add(imgWeatherProvider);
imgWeatherProvider.AutoSize();

// Add a label to display the time
x = btnTabToday.Image.GetWidth();
y = btnTabToday.Image.GetHeight();

// Hard coded 25 pixels up from the bottom ... Leave room for NewsFeed
Pos_y = imgBackground.GetHeight() - 25;

leftColWidth = (GetWidth() * 2) / 5;
rightColWidth = GetWidth() - leftColWidth;

y += (y / 4);
contentTop = y;

// Add a label to display the date
Controls.Add(lblDate);
lblDate.SetAlign("Center", "Center"); // Make sure its just below the tab
lblDate.SetFont("Font.Medium");
lblDate.SetLines(2);
int fontHeight;
fontHeight = lblDate.GetFontHeight();
fontHeight *= 2;
lblDate.SetBounds(0, contentTop, leftColWidth, fontHeight);

// Weather icon controls
Controls.Add(imgWeatherIcon1);
Controls.Add(imgWeatherIcon2);

Controls.Add(cursor);
cursor.SetBounds((GetWidth() - cursor.GetWidth()) / 2, (GetHeight() - cursor.GetHeight()) / 2);

// Add a label for temperature
Controls.Add(lblForecast);
lblForecast.SetAlign("Center", "Center");
lblForecast.SetFont("Font.Small");

lblCurrentTemp.SetAlign("Right", "Top");
lblCurrentTemp.SetFont("Font.Title");
int spacing;
spacing = lblCurrentTemp.GetFontHeight() / 2;
lblCurrentTemp.SetPadding(0, spacing, 0, 0);
Controls.Add(lblCurrentTemp);

Controls.Add(ctlAppointments); // New control to hold the appointment items

// Set up the event handler for Time/Date
time_OnNotify(); // Put something in the label so it isn't blank for the first minute
time.OnNotify = time_OnNotify; // Assign the handler function (method)
time.Start("HKLM\\System\\State\\DateTime", "Time"); // Don't know what this does??????

//load cities
root.LoadFromFile("Cities.xml"); // Open the file
root.FindNode("items", cities); // Find the list of 'cities' info
//load details for weather icons/anims
weatherImages.LoadFromFile("Weather.Images.xml"); // Open the Images file

// Load the settings into the Attributes collection
File.Read("Settings.txt", Attributes);
updateIntervalMinutes = Attributes.Item("UpdateIntervalMinutes");
int index;
// Obtain an index to appropriate city in XML file
index = Attributes.Item("CurrentCityIndex");
cities.GetChild(index, currentCity);
GetCurrentCityDetails();

// Set up weather stuff
weatherRssFetch.OnComplete = weatherRssFetch_OnComplete;
FetchWeatherReport();

// Set up news stuff
newsFilename = "CurrentNews";
imgNewsProvider.Surface.LoadFromFile("Logo.News.Provider.jif");
Controls.Add(imgNewsProvider);
imgNewsProvider.SetTabStop(true); // Needed to stop mouse clicks from going through to underlying control
imgNewsProvider.OnClick = FullStory_OnClick;
imgNewsProvider.AutoSize();
x = imgBackground.GetWidth() / 30;
y = imgBackground.GetHeight() + btnTabToday.Image.GetHeight() - ((imgNewsProvider.GetHeight() * 100) / 65);
imgNewsProvider.SetBounds(x, y);
Controls.Add(lblNews1);
lblNews1.SetAlign("Left", "Bottom");
lblNews1.SetFont("Font.Small");
lblNews1.SetPadding(0, 10, 0, 10);
//lblNews1.SetLines(2);
Controls.Add(lblNews2);
lblNews2.SetAlign("Left", "Bottom");
lblNews2.SetFont("Font.Small");
lblNews2.SetPadding(0, 10, 0, 10);
lblNews2.SetTabStop(true); // Needed to stop mouse clicks from going through to underlying control
//lblNews2.SetLines(2);
lblNews2.OnClick = FullStory_OnClick;

x += imgNewsProvider.GetWidth();
int widthOfLabel;
widthOfLabel = imgBackground.GetWidth() - (x + 15);
fontHeight = lblNews1.GetFontHeight();
y -= fontHeight;
lblNews1.SetBounds(x, y, widthOfLabel, fontHeight * 2);
lblNews2.SetBounds(x, y, widthOfLabel, fontHeight * 2);
newsUpdateTimer.OnTimer = newsUpdateTimer_OnTimer;
isNewsUpdateTimerActive = false;
newsHeadlineIndex = 0;
newsRssFetch.OnComplete = newsRssFetch_OnComplete;
fetchNewsReport();

//timer to auto update weather
weatherUpdateTimer.OnTimer = weatherUpdateTimer_OnTimer;
StartWeatherUpdateTimer();

#region Debug
////Add some labels for debug messages
//int FontHeight;
//Controls.Add(lblDebug);
//lblDebug.SetAlign("Left", "Center");
//lblDebug.SetFont("Font.Small");
//FontHeight = lblDebug.GetFontHeight();
//y = 490; // Place them off the applet
//lblDebug.SetBounds(10, y, 400, FontHeight);
//Controls.Add(lblDebug1);
//lblDebug1.SetAlign("Left", "Center");
//lblDebug1.SetFont("Font.Small");
//y += FontHeight;
//y -= 5;
//lblDebug1.SetBounds(10, y, 400, lblDebug1.GetFontHeight());
//lblDebug.BringToFront();
//lblDebug1.BringToFront();

//lblDebug.SetText("Debug");
//lblDebug1.SetText("Debug1");
#endregion // Debug
}
#endregion // Load

#region Control Events

void weatherUpdateTimer_OnTimer()
{
//has it been the required amount of time?
int minutes;
dt.Now();
minutes = dt.DifferenceInSeconds(dtLastUpdate);
minutes /= 60;
if (minutes >= updateIntervalMinutes)
{
FetchWeatherReport();
fetchNewsReport();

}
}

// Time change event handler
void time_OnNotify()
{
String s;

if (IsTomorrow)
{
dt.Now(); // Reset to today's date (Without this line date increments every time this function executes)
dt.AddDays(1); // And increment by 1. Use tomorrow's date
}
else
{
dt.Now(); // Use today's date
}
s = dt.ToRegionalTimeString("NoSeconds");
lblToday.SetText(s);
s = dt.ToRegionalDateString("dddd\nd MMM yyyy");
lblDate.SetText(s);
}

// Left tab event handler
void btnTabToday_OnClick(Control sender, int x, int y)
{
IsTomorrow = false;
btnTabToday.SetSelected(true);
btnTabTomorrow.SetSelected(false);
time_OnNotify();
LoadAppointments();
DisplayWeather();
}

// Right tab event handler
void btnTabTomorrow_OnClick(Control sender, int x, int y)
{
IsTomorrow = true;
btnTabTomorrow.SetSelected(true);
btnTabToday.SetSelected(false);
time_OnNotify(); // Force update of Time/Date
LoadAppointments();
DisplayWeather();
}

// Appointments event handler....Goes off when container control is clicked
void ctlAppointments_OnClick()
{
dt.Now();
if (IsTomorrow)
{
dt.AddDays(1);
}
Appointments.DisplayApp(dt);
}

void imgBackground_OnClick(Control sender, int x, int y) // Click background image to select the city
{
ScreenSettings s;
s.CurrentCityID = currentCityID;
s.UpdateIntervalMinutes = updateIntervalMinutes;
s.OnLocationChanged = ScreenSettings_OnLocationChanged;
s.OnIntervalChanged = ScreenSettings_OnIntervalChanged;
s.OnUpdateNow = ScreenSettings_OnUpdateNow;
FlowStack.Branch(s);
}

void ScreenSettings_OnLocationChanged(ListItem selectedItem)
{
int index;
index = selectedItem.GetIndex();

Attributes.Add("CurrentCityIndex", index); // Save it to the file
File.Write("Settings.txt", Attributes);

cities.GetChild(index, currentCity); // Get the index to the newly selected city
GetCurrentCityDetails();

FetchWeatherReport(); // Update the display
fetchNewsReport();
}

void ScreenSettings_OnIntervalChanged(ListItem selectedItem)
{
updateIntervalMinutes = selectedItem.Attributes.Item("ID");

Attributes.Add("UpdateIntervalMinutes", updateIntervalMinutes);
File.Write("Settings.txt", Attributes);

//restart timer
StartWeatherUpdateTimer();
}

void ScreenSettings_OnUpdateNow(ListItem selectedItem)
{
// Manual update
FetchWeatherReport();
fetchNewsReport();
}

#endregion // Control Events

#region News

void fetchNewsReport()
{
newsRssFetch.Start(newsUrl);
}

void newsRssFetch_OnComplete()
{
newsUpdateTimer.Stop();
isNewsUpdateTimerActive = false;

newsRssFetch.GetContent(newsReport);
if (newsReport.GetLength() > 0)
{
File.Write(newsFilename, newsReport);

newsExtractHeadlines();
// New report...Start with first headline
newsHeadlineIndex = newsFirstItemIndex;

// Restart the timer from 0
newsUpdateTimer.StartSecondsTimer(5);
isNewsUpdateTimerActive = true;
}
else
{
return;
}
// Now display the first headline
newsUpdateTimer_OnTimer();
}

void newsUpdateTimer_OnTimer()
{
newsDisplayHeadline();
newsHeadlineIndex++;
if (newsHeadlineIndex > newsLastItemIndex)
{
newsHeadlineIndex = newsFirstItemIndex;
}
}

void newsDisplayHeadline()
{
XmlNode nCurrent;
XmlNode nParent;
XmlNode nNewsItem;
String newsItem;

// This will be the node of the first headline
newsRoot.FindNode("item", nCurrent);
// This will be the node of the parent of the first headline
nParent = nCurrent.GetParent();
nParent.GetChild(newsHeadlineIndex, nNewsItem);
nNewsItem.GetChildValue("title", newsItem);
nNewsItem.GetChildValue("link", urlFullStory);

//Replace XML Escape sequences
newsItem.Replace("&amp;", "&");
newsItem.Replace("&#38", "&");
newsItem.Replace("&apos;", "'");
newsItem.Replace("'", "'");
newsItem.Replace("&gt;", ">");
newsItem.Replace(">", ">");
newsItem.Replace("&lt;", "<");
newsItem.Replace("&#60;", "<");
// How do you escape quotes in Pointui script??
//newsItem.Replace("&quot;", """);
//newsItem.Replace(""", """);

// Fade old headline into new one
if (newsIsLabel1)
{
newsIsLabel1 = false;
lblNews1.SetText(newsItem);
lblNews1.AnimateClear();
lblNews1.AnimateFade(0, 100, 1);
lblNews2.AnimateClear();
lblNews2.AnimateFade(100, 0, 1);

}
else
{
newsIsLabel1 = true;
lblNews2.SetText(newsItem);
lblNews2.AnimateClear();
lblNews2.AnimateFade(0, 100, 1);
lblNews1.AnimateClear();
lblNews1.AnimateFade(100, 0, 1);
}
}

void newsExtractHeadlines()
{
XmlNode nCurrent;
XmlNode nParent;

// Parse XML Headlines
// Load the file
newsRoot.LoadFromFile(newsFilename);
// This will be the node of the first headline
newsRoot.FindNode("item", nCurrent);
// This will be the node of the parent of the first headline (should be called "Channel")
nParent = nCurrent.GetParent();
// Index to first <item> under parent node
newsFirstItemIndex = nCurrent.GetIndex();
// Last item is not a headline
newsLastItemIndex = nParent.GetChildCount() - 2;
}

// Get the full story
void FullStory_OnClick() {

// lblDebug.SetText(urlFullStory);
Process.Start(urlFullStory);
}
#endregion //News

#region Weather

void GetCurrentCityDetails()
{
currentCity.GetChildValue("id", currentCityID);
currentCity.GetChildValue("text", currentCityName);
currentCity.GetChildValue("url", weatherUrl);
currentCity.GetChildValue("newsurl", newsUrl);
//work out name of local weather cache file
weatherFilename = "WeatherData_" + currentCityID + ".xml";
weatherFilename.Replace("|", "_");

}

void FetchWeatherReport()
{
//save time whether update fails or succeeds
dtLastUpdate.Now();
//start the download
weatherRssFetch.Start(weatherUrl); // Read the weather report for the selected city
cursor.SetVisible(true);
//lblDebug.SetText(weatherUrl);
}

void weatherRssFetch_OnComplete()
{
cursor.SetVisible(false);

//lblDebug.SetText("rss Fetch Complete");
weatherRssFetch.GetContent(weatherReport);
DisplayWeather();
}

String DecodeForecast(String forecast)
{
int i;
int idxFirstChar, idxLastChar;
String temp;

String forecastHiTemp, forecastLowTemp;

// Extract high & low temperatures from tomorrow's forecast
temp = forecast;
idxFirstChar = temp.IndexOf("High: "); // Find the first colon
idxFirstChar += 6; // Get past the colon and space
temp = temp.SubString(idxFirstChar, 10);
idxLastChar = temp.IndexOf(" "); // Find the next space
forecastHiTemp = "H:" + temp.SubString(0, idxLastChar);

temp = forecast;
idxFirstChar = temp.IndexOf("Low: "); // Find the first colon
idxFirstChar += 5; // Get past the colon and space
temp = temp.SubString(idxFirstChar, 10);
idxLastChar = temp.IndexOf(" "); // Find the next space
forecastLowTemp = "L:" + temp.SubString(0, idxLastChar);

//Report = Forecast; // make a copy for later

return forecastLowTemp + " " + forecastHiTemp;
}

void DisplayWeather()
{
String Current; // Current weather info (Long version from <description>)
String CurrentTitle; // Current weather info (Short version from <title>)
String forecast; // Report for tomorrow (from <description>)

String currentTemp;


int numberOfIcons;

XmlNode n;
XmlNode nCurrent;
XmlNode nCurrentTitle;
XmlNode nForecast;
XmlNode nFirstItemParent;

int x, y;

int currentIconIdx; // Icon Number for current weather
int forecastIconIdx; // Icon number for forecast weather

String s;
String iconName;

String imageFile1, imageFile2;
int iOffset1, iOffset2;

int firstItemIndex;

//switch off weather related controls
imgWeatherIcon1.SetVisible(false);
imgWeatherIcon2.SetVisible(false);
lblForecast.SetVisible(false);
lblCurrentTemp.SetVisible(false);

// Write the weather report to file (if it exists)
if (weatherReport.GetLength() > 0)
{
File.Write(weatherFilename, weatherReport);
}
else
{
return;
}
// Parse XML file for Current report and Tomorrow's forcast
n.LoadFromFile(weatherFilename);
n.FindNode("item", nCurrent);
nCurrent.GetChildValue("description", Current); // Current weather
nCurrent.GetChildValue("title", CurrentTitle);


firstItemIndex = nCurrent.GetIndex();
nFirstItemParent = nCurrent.GetParent();
if (IsTomorrow)
{
//get tomorrow forecast
firstItemIndex += 2;
}
else
{
//get today's forecast
firstItemIndex++;
}
nFirstItemParent.GetChild(firstItemIndex, nForecast);
nForecast.GetChildValue("description", forecast);

s = DecodeForecast(forecast);
lblForecast.SetText(s);
lblForecast.SetVisible(true);

int i;
y = contentTop + lblDate.GetHeight();

if (IsTomorrow == false)
{
// Extract current temperature from today's weather report
int idxFirstChar, idxLastChar;
s = Current;
idxFirstChar = s.IndexOf(": "); // Find the first colon
idxFirstChar += 2; // Get past the colon and space
s = s.SubString(idxFirstChar, 10);
idxLastChar = s.IndexOf(" "); // Find the next space
idxLastChar += 3;
currentTemp = s.SubString(0, idxLastChar);
lblCurrentTemp.SetText(currentTemp);
lblCurrentTemp.SetVisible(true);

i = y + (lblCurrentTemp.GetFontHeight() / 3);
lblCurrentTemp.SetBounds(0, i, leftColWidth, lblCurrentTemp.GetFontHeight());

lblCurrentTemp.AnimateClear();
lblCurrentTemp.AnimateAscend(lblCurrentTemp.GetFontHeight(), 2);
}

// Extract the Icons
s = forecast; // Keep Report pristine
i = s.IndexOfRev("/"); // Find the last '/'
if (i > 0)
{
s.Delete(0, i + 1); // Delete the string from the start to the last '/'
i = s.IndexOf("_");
if (i > 0)
{
s.Delete(i, s.GetLength()); // Icon number as a string (ie "16")
}
}
iconName = "icon_";
iconName += s; // Now s1 is the node name of the node we want

weatherImages.FindNode(iconName, nCurrent); // Find the node for this image (WHAT IF IT ISN'T IN THE FILE ????????????)
nCurrent.GetChildValue("img1", imageFile1);
nCurrent.GetChildValue("img1_xoffset", iOffset1); // Obtain the offset for image1
numberOfIcons = nCurrent.GetChildCount(); // / 2; // How many Icon/offset pairs are there?
numberOfIcons /= 2;
if (numberOfIcons == 2)
{
nCurrent.GetChildValue("img2", imageFile2);
nCurrent.GetChildValue("img2_xoffset", iOffset2); // Obtain the offset for icon2
}

// Whack up the first icon
imgWeatherIcon1.Surface.LoadFromFile(imageFile1); // Load the appropriate image
imgWeatherIcon1.AutoSize();
x = (leftColWidth - imgWeatherIcon1.GetWidth()) / 2; // Icon position
imgWeatherIcon1.SetBounds(x + iOffset1, y); // Position the control where it needs to start
imgWeatherIcon1.AnimateClear();
imgWeatherIcon1.AnimateFade(0, 100, 3);
imgWeatherIcon1.SetVisible(true);

// If there is a second Icon then whack it up also
if (numberOfIcons == 2)
{
imgWeatherIcon2.Surface.LoadFromFile(imageFile2); // Load the appropriate image
imgWeatherIcon2.AutoSize();
imgWeatherIcon2.SetBounds(x + iOffset2, y); // Position the control where it needs to start
imgWeatherIcon2.AnimateClear();
imgWeatherIcon2.AnimateMove(x, y, 1.5, 0, 0.1); // Animate it to the destination location
imgWeatherIcon2.AnimateFade(0, 100, 0.5);
imgWeatherIcon2.SetVisible(true);
}

y += (imgWeatherIcon1.GetHeight() - (lblForecast.GetFontHeight() / 2));
lblForecast.SetBounds(0, y, leftColWidth, lblForecast.GetFontHeight());
// y += (lblForecast.GetFontHeight() * 2);
y += (lblForecast.GetFontHeight() * 100)/66;
x = (leftColWidth - imgWeatherProvider.GetWidth()) / 2;
imgWeatherProvider.SetOpacity(50);
imgWeatherProvider.SetBounds(x, y);

}

void StartWeatherUpdateTimer()
{
weatherUpdateTimer.Stop();
if (updateIntervalMinutes > 0)
{
//start timer
//NOTE: hard code a 1 min check because time doesn't; increment while device is switched off
weatherUpdateTimer.StartMinuteTimer(1);
}
}

#endregion

#region Appointments
void LoadAppointments()
{
int App_w, App_h, App_x, App_y;
App_y = btnTabToday.Image.GetHeight();
App_w = rightColWidth;
App_x = GetWidth() - App_w;
App_h = GetHeight() - App_y;
ctlAppointments.SetBounds(App_x, App_y, App_w, App_h); // Position it on parent applet

ctlAppointments.SetTabStop(true); // Needed to stop mouse clicks from going through to underlying control
ctlAppointments.OnClick = ctlAppointments_OnClick;

// Put real buttons and labels in the Appointments area
DataTable tbl;
Appointments.GetAppointments(tbl);
tbl.SetMaxItems(4);
tbl.SetSort("Start");
String filter;
filter = "[End] >= <{Now} AND [Start] < <{End}";

//get current datetime
dt.Now();
//are we on tomorrow tab?
if (IsTomorrow)
{
dt.AddDays(1);
dt.SetStartOfDay(); // Set it to 12:00 (Midnight)
}

String tmp;
float f;

f = dt.ToVariantTime();
tmp = f.ToString("%.5f");
filter = filter.Replace("{Now}", tmp);

dt.AddDays(1);
f = dt.ToVariantTime();
f.Trunc();
tmp = f.ToString("%.0f");
filter = filter.Replace("{End}", tmp);

tbl.SetRestriction(filter);

ctlAppointments.Controls.Clear();

//y = btnTabToday.ImageSelected.GetHeight(); // Start just below the tabs
int y;
y = 0;
//int appletWidth;
//appletWidth = GetWidth();
while (tbl.MoveNext())
{
AppointmentsRow row;
ctlAppointments.Controls.Add(row);
row.Set(tbl, y); //, appletWidth);
y += row.GetHeight();
//TableIndex -= 1;
}
if (y == 0)
{
//no appointments
Label lbl;
ctlAppointments.Controls.Add(lbl);
lbl.SetBounds(0, 0, ctlAppointments.GetWidth(), ctlAppointments.GetHeight());
lbl.SetAlign("Center", "Center");
lbl.SetText("Calendrier");
}
}

#endregion

void Activated()
{
LoadAppointments();
if (isNewsUpdateTimerActive)
{
newsUpdateTimer.StartSecondsTimer(5);
}
}

void AppGotFocus()
{
LoadAppointments();
if (isNewsUpdateTimerActive)
{
newsUpdateTimer.StartSecondsTimer(5);
}
}

void AppLostFocus()
{
newsUpdateTimer.Stop();
}

void Deactivated()
{
newsUpdateTimer.Stop();
if (newsIsLabel1)
{
lblNews1.AnimateClear();
lblNews1.SetOpacity(0);
} else {
lblNews2.AnimateClear();
lblNews2.SetOpacity(0);
}
}

}
#endregion

#region Custom Controls

class AppointmentsRow : Button
{
Label lblSubject;

int x, y, w, h;

String s;

DateTime dtStart, dtEnd;
bool isAllDayEvent;

bool isComplete;

Image imgDot;

int ObjectID;

void Load()
{
OnClick = OnClick_Handler;

//Image.LoadFromFile("Row.Background.jif");
ImageSelected.LoadFromFile("Appointment.Background.Selected.jif");

lblSubject.SetAlign("Left", "Center");
lblSubject.SetFont("Font.Small");
lblSubject.SetLines(2);
Controls.Add(lblSubject);

imgDot.Surface.LoadFromFile("Icon.Bullet.Point.jif");
}


void Set(DataTable tbl, int y)
{
w = ImageSelected.GetWidth();
h = ImageSelected.GetHeight();

//position the button
//x = appletWidth - w;
SetBounds(0, y, w, h); // 160 is 1/3 of screen width


//get data from the table
tbl.GetValue("ObjectID", ObjectID);
tbl.GetValue("Subject", s);
tbl.GetValue("End", dtEnd);
tbl.GetValue("Start", dtStart);
tbl.GetValue("AllDayEvent", isAllDayEvent);

int padLeft, padRight;
padRight = imgDot.Surface.GetWidth();
if (isAllDayEvent)
{
//just a little bit of padding on the left
padLeft = padRight / 2; // padRight;
}
else
{
padLeft = padRight;
//enough padding for the dot
Controls.Add(imgDot);
//position dot vertically centered
int top;
top = (h - imgDot.GetHeight()) / 2;
imgDot.SetBounds(0, top);

String time;
time = dtStart.ShortTimeRange(dtEnd);
s = time + ": " + s;
}
//set the padding
lblSubject.SetPadding(0, padRight, 0, padLeft);
lblSubject.SetBounds(0, 0, w, h);
lblSubject.SetText(s);
}

void OnClick_Handler(Control sender, int x, int y)
{
//show task
Appointments.Display(ObjectID);
}

}

#endregion

#region Screens

class ScreenSettings : ListScreen
{
Label lblTitle;

Event OnUpdateNow;

String CurrentCityID;
String UpdateIntervalMinutes;

void Load()
{
Controls.Add(lblTitle);
SetTitlePosition(lblTitle);
lblTitle.SetText("Configuration de l Applet Today");

AddItem("City", "Selection de la Ville");
AddItem("Interval", "Intervalle de la Mise a Jour");
AddItem("UpdateNow", "Mise a Jour Immediate");


SetSoftKeys("Back", Terms.Get("Retour"));

OnListItemClick = OnListItemClick_Handler;
}

void OnListItemClick_Handler(ListItem li, int x, int y)
{
String id;
id = li.Attributes.Item("ID");

if (id == "City")
{
//show the select city screen
ScreenSelectLocation s;
s.SetSelectedItemID(CurrentCityID);
s.OnDone = ScreenSelectLocation_OnDone;
FlowStack.Branch(s);
}
else if (id == "Interval")
{
//show the select interval screen
ScreenSelectUpdateInterval s;
s.SetSelectedItemID(UpdateIntervalMinutes);
s.OnDone = ScreenSelectUpdateInterval_OnDone;
FlowStack.Branch(s);
}
else if (id == "UpdateNow")
{
OnUpdateNow();
FlowStack.Return();
}
}

Event OnLocationChanged;
void ScreenSelectLocation_OnDone(ListItem selectedItem)
{
CurrentCityID = selectedItem.Attributes.Item("ID");
OnLocationChanged(selectedItem);
}
Event OnIntervalChanged;
void ScreenSelectUpdateInterval_OnDone(ListItem selectedItem)
{
UpdateIntervalMinutes = selectedItem.Attributes.Item("ID");
OnIntervalChanged(selectedItem);
}

}

class ScreenSelectLocation : ListScreen
{
XmlNode root, items;
DataTable tbl;

Event OnDone;

Label lblTitle;

void Load()
{
Controls.Add(lblTitle);
SetTitlePosition(lblTitle);
lblTitle.SetText("Selection de la ville a voir");

root.LoadFromFile("Cities.xml");
root.FindNode("items", items);
items.GetDataTable(tbl);

SetData(tbl);

SetSoftKeys("Back", Terms.Get("Retour"));

OnListItemClick = OnListItemClick_Handler;
}

void InitListItem(ListItem li)
{
//set the type of list item
li.SetType("Default");

//read from the data table the bits that are needed for this list item
String id, name;
tbl.GetValue("id", id);
tbl.GetValue("text", name);

//set list item attributes
li.Attributes.Add("ID", id);
li.Attributes.Add("Text", name);
}

void OnListItemClick_Handler(ListItem selectedItem, int x, int y)
{
OnDone(selectedItem);
FlowStack.Return();
}

}

class ScreenSelectUpdateInterval : ListScreen
{
Label lblTitle;

void Load()
{
Controls.Add(lblTitle);
SetTitlePosition(lblTitle);
lblTitle.SetText(Terms.Get("Selection de l intervalle de Mise a Jour"));

AddItem("0", Terms.Get("Manual"));
//AddItem("1", Terms.Get("1 Minute"));
//AddItem("5", Terms.Get("5 Minutes"));
AddItem("60", Terms.Get("1 Hour"));
AddItem("120", Terms.Get("2 Hours"));
AddItem("240", Terms.Get("4 Hours"));
AddItem("480", Terms.Get("8 Hours"));
AddItem("1440", Terms.Get("24 Hours"));

SetSoftKeys("Back", Terms.Get("Retour"));

OnListItemClick = OnListItemClick_Handler;
}

Event OnDone;
void OnListItemClick_Handler(ListItem selectedItem, int x, int y)
{
OnDone(selectedItem);
FlowStack.Return();
}

}

#endregion

Répondre en citant  |   | Revenir en haut de page  | 
atthalinf
Posté le: 18/02/2009 16:34

MERCI c'est mieux en français
Mais je ne vois pas comment cela peut résoudre mon problème de lien automatique vers Opéra lorsque je pointe sur la liste, en bas de l'applet Today, aprés le mot 'Google'

Répondre en citant  |   | Revenir en haut de page  | 
ManQ1 Nephrite 218DA8
Posté le: 18/02/2009 23:10

rassure toi moi il me marque impossible d ouvrir le fichier....

Répondre en citant  |   | Revenir en haut de page  | 
Montecristoff
Posté le: 19/02/2009 23:20

atthalinf a écrit:
Bonsoir

Dans l'applet ToDay lorsque je pointe sur la barre Google en bas qui me propose l'accés à divers flux c'est OPERA Beta qui se lance
Or il a tendant a faire 'Out of <memory'
Est il possible de paramétrer le lien pour aller vers un autre explorer : Opera mini ou simplement Explorer

je chereche depuis 2 jours en vain

Merci pour ce beau produit

Quand tu cliques sur le flux RSS inclus sur l'applet Today, Home 2 lance une session de ton navigateur par défaut pour afficher l'intégralité de l'article.
Si tu veux modifier ton navigateur par défaut, tu dois modifier la base de registre de ton appareil pour remplacer Opera par IE.
(je ne sais plus quelle clé c'est, désolé...)

Cool

Répondre en citant  |   | Revenir en haut de page  | 
ManQ1 Nephrite 218DA8
Posté le: 20/02/2009 00:09

Essaie de modifier dans la base de registre le paramètre
HKEY_LOCAL_MACHINE\Software\Microsoft\Shell\Rail\: DEFBROWSER\ "1"

:MSPIE par OperaL.exe



et pour remettre ie par default tu cherches les clés qui donnent les valeurs de
:DEFBROWSER avec :MSPIE comme valeur
:MSPIE avec iexplorer.exe comme valeur

Répondre en citant  |   | Revenir en haut de page  | 
ManQ1 Nephrite 218DA8
Posté le: 21/02/2009 00:54

item>
<id>EUR|FR|FR012|PARIS</id>
<text>Paris</text>
<x>330</x>
<y>67</y>
<url>http://rss.accuweather.com/rss/liveweather_rss.asp?metric=1&locCode=EUR|FR|FR012|PARIS</url>
<newsurl>http://news.google.com.au/news?ned=fr&output=rss</newsurl>
<gmtOffsetMinutes>60</gmtOffsetMinutes>
</item>
- <item>

et pour mettre en Celcius modifier le fichier cities et changer la valeur 0 en valeur 1 apres le mot metric=


pour changer cette valeur cliquer sur cities.xml cela ouvre une page internet faites un clic droit sur cette page et clic sur afficher la source une page bloc note s ouvre rechercher le mot "Paris" c est simple c est par ordre alphabetique donc vers le milieu de la page (enfin presque) puis changer la valeur 0 en 1 apres metric=

voila vous fermer vous dites oui pour les modif et remplacer le cities par celui la (j ai changer aussi le nom et j ai mis compiegne au lieu de paris) ah et le cities.xml dans world est le meme donc a remplacer aussi par celui ci...

Répondre en citant  |   | Revenir en haut de page  | 
atthalinf
Posté le: 22/02/2009 11:42

Grand merci
J'essaie

Pour info chez moi Opera mini s'appelle jbed.exe


ManQ1 Nephrite 218DA8 a écrit:
Essaie de modifier dans la base de registre le paramètre
HKEY_LOCAL_MACHINE\Software\Microsoft\Shell\Rail\: DEFBROWSER\ "1"

:MSPIE par OperaL.exe



et pour remettre ie par default tu cherches les clés qui donnent les valeurs de
:DEFBROWSER avec :MSPIE comme valeur
:MSPIE avec iexplorer.exe comme valeur


Répondre en citant  |   | Revenir en haut de page  | 
ManQ1 Nephrite 218DA8
Posté le: 02/03/2009 10:51

Bon voila une version de Today ici qui merite de remplacer celle ci sauf qu il n y a pas la ligne de Google mais la date a la place ce qui serait bien c est qu on rajoute les codes a mettre dans le today.cs car j ai du mal a les trouver et ca sera aussi pour paufiner cet applet en version francaise que je viens de finir a traduire....

Répondre en citant  |   | Revenir en haut de page  | 
Montecristoff
Posté le: 02/03/2009 11:46

Bonjour ManQ1,

Citation:
ce qui serait bien c est qu on rajoute les codes a mettre dans le today.cs car j ai du mal a les trouver

Si tu parles des codes pour la meteo, et donc du fichier cities.xml, tu trouveras plus d'informations ici
mais egalement la .

Cool

Répondre en citant  |   | Revenir en haut de page  | 
ManQ1 Nephrite 218DA8
Posté le: 04/03/2009 10:19

Montecristoff a écrit:
Bonjour ManQ1,

Citation:
ce qui serait bien c est qu on rajoute les codes a mettre dans le today.cs car j ai du mal a les trouver

Si tu parles des codes pour la meteo, et donc du fichier cities.xml, tu trouveras plus d'informations ici
mais egalement la .

Cool


non ca j ai deja fait je me suis mal exprime je parlais de la barre google qui s affiche en bas avec les news a la place j ai la date et cela ne m interresse pas j aurais pefere remettre la barre Google mais il doit me manquer une partie du code.....

Répondre en citant  |   | Revenir en haut de page  | 
baudas
Posté le: 04/03/2009 12:45

Bonjour

Je cherche à savoir s'il est possible de définir 2 timers pour un même contrôleur. L'objectif serait de faire clignoter régulièrment l'indicateur de charge batterie sur le Today.

Cordialement.

Répondre en citant  |   | Revenir en haut de page  | 
baudas
Posté le: 04/03/2009 17:20

Tant que j'y suis encore une petite.

Comment utiliser un image JIF existante. J'ai bien le convertisseur PNG -> JIF

mais quid de l'autre sens ?

Je ne trouve pas d'éditeur d'images JIF

Merci

Répondre en citant  |   | Revenir en haut de page  | 
Montecristoff
Posté le: 04/03/2009 19:36

@ManQ1
Citation:
j aurais pefere remettre la barre Google mais il doit me manquer une partie du code.....

Probablement...

@baudas
2 timers pour un même contrôle, je n'ai jamais essayé... Mais je dirai à priori pourquoi pas ?
Par contre si ton objectif est de faire clignoter un indicateur sur une applet, je pense que cela peut être gourmand selon la fréquence et la taille de ton image...

En ce qui concerne le format jif, il n'est pas éditable car c'est un format propriétaire, protégé par Pointui.

Cool

Répondre en citant  |   | Revenir en haut de page  | 
baudas
Posté le: 05/03/2009 10:16

Bonjour
Le clignotement serait plus gourmand que l'allumage constant ?

Je ne comprends pas pourquoi mais effectivement j'ai trouvé une astuce sans utiliser 2 timer et la batterie à l'air de s'en ressentir.

Alors pour le JIF je ne comprends pas. Cette IHM est ouverte et très évolutive. Les possibilités d'évolution sont presque infinies. Faire clignoter un indicateur par exemple est trivial Par contre changer la couleur de cet indicateur devient le parcours du combattant. Avec un format non éditable, impossible de s'appuyer sur l'existant. Cela va quand même limiter très largement les possibilités d'évolutions, les images constituant quand même la base de l'IHM. Avec la version Pro (payante) envisagez vous de fournir des outils d'éditions JIF -> PNG et PNG -> JIF parce que franchement une conversion dans un seul sens sous DOS c'est quand même un peu la misère!...

Donc pour en revenir à ma question initiale comment puis-je modifier une image d'une applet ? La seule solution est-elle de s'adresser au concepteur et lui demander ses images dans un format lisible ? avec les problèmes de langues quand on a affaire à des étrangers qui causent pas la france, ça risque de freiner les candidats au développement non ?

Cordialement et bravo et merci pour votre travail à tous.

Répondre en citant  |   | Revenir en haut de page  | 
Montecristoff
Posté le: 05/03/2009 13:35

Bonjour baudas,


Citation:
Le clignotement serait plus gourmand que l'allumage constant ?

Je ne comprends pas pourquoi mais effectivement j'ai trouve une astuce sans utiliser 2 timer et la batterie a l'air de s'en ressentir.

Clignotement = affichage/masquage repete d'une ou de plusieurs images = de multiples rafraichissement de la zone qui contient ces images = surconsommation d'energie par apport a une image statique, bien sur.
Donc en comparaison, un allumage constant est moins gourmand qu'un allumage constant qui comprend un clignotement.
Si on prend l'exemple d'une horloge qui comprend une aiguille indiquant les secondes, son affichage sera plus gourmand en energie que la meme horloge sans cette trotteuse.

Le format jif a ete cree pour deux raisons principales : reduire le volume des images et accelerer la vitesse d'affichage, tout cela sans deperdition de qualite.

Le fait qu'il ne soit pas editable n'est pas un frein ni une limite.
Si tu ne possedes pas tes propres images au format png et que tu veux reutiliser celles d'un autre concepteur qui sont uniquement disponibles au format jif, il suffit de lui demander. Certains developpeurs proposent deja leurs images png a la communaute.

Citation:
Faire clignoter un indicateur par exemple est trivial Par contre changer la couleur de cet indicateur devient le parcours du combattant

Si pour toi faire clignoter un indicateur correspond a l'action afficher/masquer, c'est effectivement trivial.
Mais il est tout aussi simple d'en changer la couleur en jouant avec deux images identiques (du moins dans leurs contours) ayant deux couleurs differentes.

En tout etat de cause, si tu as de bonnes idees et que la partie graphique te pose probleme, n'hesite pas le demander ici ou la bas.

Cool

Répondre en citant  |   | Revenir en haut de page  | 
baudas
Posté le: 05/03/2009 14:36

Merci pour ces rensignements

Répondre en citant  |   | Revenir en haut de page  | 
bob_moran
Posté le: 10/03/2009 15:22

pour mettre un français tu "colle" ou toute les lignes de codes du début du post ? Shocked

Répondre en citant  |   | Revenir en haut de page  | 
bob_moran
Posté le: 10/03/2009 17:24

c'est bon j'ai trouver Wink

Répondre en citant  |   | Revenir en haut de page  | 
Poster un nouveau sujet
Répondre au sujet




Voir le sujet suivant
Voir le sujet précédent

Forum version classique