Show_menu
Hello all,
I am hoping someone will be able to shed light on this matter.
I have been resonsible for converting a series of forms from v6 to run on version Oracle 10g. I have a problem in that one of the deprecated built-ins in forms builder 10 is the infamous show_menu. I have read the oracle docs, and they all seem to indicate that if it is used, I'm screwed. 'No alternative functionality or upgarde path' springs to mind. Helpful.
I have tried to search on this forum, and on the web in general, but no one seems willing or able to answer the following questions: 'what should happen with the call to show_menu?' and 'what is the workaround to the problem?' In fact, people only seem to be offering a bunch of 'migration tools' they are selling.
*** I am not interested in migration tools!!! ***
Obviously the call to show_menu must be removed since its presence will cause the compiler to go into a fit, but what is the workaround to not having it? I have a menu, it needs to be displayed.
Regards.
Hy,
I have found 14-Apr-05, on metalink, hope help you:
https://metalink.oracle.com/metalink/plsql/f?p=200:27:1256652304030905176::::p27_id,p27_show_header,p27_show_help:559239.994,1,1
Similar Messages
-
Hi,
I'm migrating my forms 6 app to forms 9. There (in 6i) we used the command "show_menu" that appers as invalid wheh compiling the same form in 9i.
We have some user running this app. in 6i and will have another ones running in 9i, and we would like to use the same source code.
We tried to replace the "show_menu" call in our forms-library using a new procedure called "show_menu" that decides if the user if runnig in WEB (9i) or not to call the standard.show_menu or not. But it failed because it doesn't exists.
Is there any work-around to this problem?
Thanks in advanceI had this happen to me also. It is a carry over from Forms6i mysterious aborts caused by some triggers which probably do not adhere to Oracle design standards.
Look into folder <DSHOME>/forms90/trace for a file like
ifweb90_dump_12345.trc.
It will tell you which trigger aborted the form.
Either fix the trigger or put some comment in the trigger. The latter has resolved my problems when the trigger was correctly designed.
Suresh -
9i form gen inserts unsupported call to SHOW_MENU ?!?
... in a pre-form trigger, causing all compilations to fail. I have tried generating forms with no templates and no object libraries -- it still generates the call.
Has anyone else seen this, or is this a case of "ORA-001 : User IQ too low." ?This is inserted into every generated form:
/* CGSM$SHOW_STRIP_MENU */
/* Display the strip menu at the top of the screen on entry into form */
BEGIN
show_menu;
END;
As you know, "SHOW_MENU" is not supported in forms 9i. I have worked around this by creating my own "show_menu" which does "null;" in a .pll that I attach to all generated forms, but that is more than a bit hokey.
I was thinking that perhaps this is coming from an old template or something, butI can't find it in any of the distributed templates or object libraries. I also checked to see if perhaps through bad registry entries somewhere, it was looking at old Des6i templates in my ora806 directory, but even after renaming the ora806 directory to 806old, it still managed to insert the show_menu call. -
Problem with Double Buffering and Swing
Hi
I made a game and basically it works pretty well, my only problem is it flickers really badly right now. I read up on a whole lot of forums about double buffering and none of those methods seemed to work. Then I noticed that Swing has double buffering built in so I tried that but then I get compilation errors and I'm really not sure why. My original code was a console application and worked perfectly, then I ported it into a JApplet and it still works but it flickers and thats what I'm tryign to fix now.
The code below is in my main class under the constructor.
Heres the double buffering code I'm trying to use, I'm sure you all seen it before lol
public void update(Graphics g)
// initialize buffer
if (dbImage == null)
dbImage = createImage(this.getSize().width, this.getSize().height);
dbg = dbImage.getGraphics();
// clear screen in background
dbg.setColor(getBackground());
dbg.fillRect(0, 0, this.getSize().width, this.getSize().height);
// draw elements in background
dbg.setColor(getForeground());
paint(dbg);
// draw image on the screen
g.drawImage(dbImage, 0, 0, this);
}My paint is right under neath and heres how it looks
This snipet of code works but when I change the method to
public paintComponent(Graphics g){
super.paintComponent(g)...
everythign stops working and get a compilation error and says that it can't find paintComponent in javax.swing.JFrame.
public void paint(Graphics g)
super.paint(g);
//if game starting display menue
if (show_menue)
//to restart lives if player dies
lives = 3;
menue.draw_menue(g);
menue_ufo1.draw_shape(g);
menue_ufo2.shape_color = Color.DARK_GRAY;
menue_ufo2.draw_shape(g);
menue_ufo3.shape_color = Color.BLUE;
menue_ufo3.draw_shape(g);
menue_ufo4.shape_color = new Color(82, 157, 22);
menue_ufo4.draw_shape(g);
menue_ufo5.draw_shape(g);
menue_ufo6.shape_color = new Color(130, 3, 3); ;
menue_ufo6.draw_shape(g);
menue_turret.draw_ship(g);
menue_ammo.draw_ammo(g);
else
//otherwise redraw game objects
gunner.draw_ship(g);
y_ammo.draw_ammo(g);
grass.draw_bar(g);
o_ufo.draw_shape(g);
b_ufo.draw_shape(g);
m_ufo.draw_shape(g);
s_ufo.draw_shape(g);
z_ufo.draw_shape(g);
xx_ufo.draw_shape(g);
info.draw_bar(g);
live_painter.draw_lives(g, lives);
score_painter.draw_score(g, score);
level_display.draw_level(g, level);
explosion.draw_boom(g);
}I just want to get rid of the flickering for now so any help will be greatly appreciated. Depending which will be simpler I can either try to double buffer this program or port it all to swing but I'm not sure which elements are effected by AWT and which by Swing. Also I read some of the Java documentation but couldn't really understand how to implement it to fix my program.
Thanks in advance
SebastianThis is a simple animation example quickly thrown together. I have two classes, an animation panel which is a JPanel subclass that overrides paintComponent and draws the animation, and a JApplet subclass that simply holds the animation panel in the applet's contentpane:
SimpleAnimationPanel.java
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.JPanel;
import javax.swing.Timer;
class SimpleAnimationPanel extends JPanel
private static final int DELAY = 20;
public static final int X_TRANSLATION = 2;
public static final int Y_TRANSLATION = 2;
private Point point = new Point(5, 32);
private BufferedImage duke = null;
private Timer timer = new Timer(DELAY, new TimerAction());
public SimpleAnimationPanel()
try
// borrow an image from sun.com
duke = ImageIO.read(new URL(
"http://java.sun.com/products/plugin/images/duke.wave.med.gif"));
catch (MalformedURLException e)
e.printStackTrace();
catch (IOException e)
e.printStackTrace();
setPreferredSize(new Dimension(600, 400));
timer.start();
// do our drawing here in the paintComponent override
@Override
protected void paintComponent(Graphics g)
super.paintComponent(g);
if (duke != null)
g.drawImage(duke, point.x, point.y, this);
private class TimerAction implements ActionListener
@Override
public void actionPerformed(ActionEvent e)
int x = point.x;
int y = point.y;
Dimension size = SimpleAnimationPanel.this.getSize();
if (x > size.width)
x = 0;
else
x += X_TRANSLATION;
if (y > size.height)
y = 0;
else
y += Y_TRANSLATION;
point.setLocation(new Point(x, y)); // update the point
SimpleAnimationPanel.this.repaint();
}AnimationApplet.java
import java.lang.reflect.InvocationTargetException;
import javax.swing.JApplet;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class AnimationApplet extends JApplet
public void init()
try
SwingUtilities.invokeAndWait(new Runnable()
public void run()
// construct the panel
JPanel simpleAnimation = new SimpleAnimationPanel();
// put it in the contentPane of the JApplet
getContentPane().add(simpleAnimation);
setSize(simpleAnimation.getPreferredSize());
catch (InterruptedException e)
e.printStackTrace();
catch (InvocationTargetException e)
e.printStackTrace();
}Here's a 3rd bonus class that shows how to put the JPanel into a stand-alone program, a JFrame. It's very similar to doing it in the JApplet:
AnimationFrame.java
import javax.swing.JFrame;
public class AnimationFrame
private static void createAndShowUI()
JFrame frame = new JFrame("SimpleAnimationPanel");
frame.getContentPane().add(new SimpleAnimationPanel());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
public static void main(String[] args)
java.awt.EventQueue.invokeLater(new Runnable()
public void run()
createAndShowUI();
}Edited by: Encephalopathic on Mar 15, 2008 11:01 PM -
can any one help me with correcting the code or can any one give me another code for using it in the login form.
this is my problem:-
i had make a login form using in oracle 9i form builder >>>in this form i have three text boxes one for intering user name and the second one for entering the password and the third text box is not visible and it is used for counting the tries.
In addition i have a three buttons , one is for login and the two others are not visible and they are a show main menu button and a exit button. For login button i had put a WHEN-BUTTON-PRESSED trigger in the login button and it must check if the user name and the password match what it is on the login table so it allow the user to see the show main menu button otherwise if the user name or the password are wrong and has been putted wrong for 3 times of trying then it will show the exit button.
and this is a picture of the login form in the design view.
http://www.al7loh.com/uploader/uploads/login.JPG
and this is the code for theWHEN-BUTTON-PRESSED trigger on the login button
declare
alertNum number;
dummy1 tbl_login.USER_NAME%type;
dummy2 tbl_login.PASS%type;
begin
select tbl_login.USER_NAME, tbl_login.PASS into dummy1, dummy2 from tbl_login where tbl_login.USER_NAME = :LOGIN.USER_NAME and
tbl_login.PASS = :LOGIN.PASS;
if :LOGIN.TRIES<3 then
if sql%found
then
set_item_property('LOGIN.SHOW_MENU', visible, property_true);
set_item_property('LOGIN.SHOW_MENU', enabled, property_true);
else
message ('Invalid password....try again');
:LOGIN.TRIES := :LOGIN.TRIES+1;
:LOGIN.USER_NAME := null;
:LOGIN.PASS := null;
end if;
else
message ('Exceeded Number of tries..press exit button');
set_item_property('LOGIN.EXIT', visible, property_true);
set_item_property('LOGIN.EXIT', enabled, property_true);
end if;
end;
can any one help me correcting the code of the WHEN-BUTTON-PRESSED trigger on the login form or can any one give me another code for using it in the login form.
i hope to get some help from the experts>>> ??!?!?!?!?!Something like this
declare
alertNum number;
dummy1 tbl_login.USER_NAME%type;
dummy2 tbl_login.PASS%type;
begin
Begin
select tbl_login.USER_NAME, tbl_login.PASS
into dummy1, dummy2
from tbl_login
where tbl_login.USER_NAME = :LOGIN.USER_NAME
and tbl_login.PASS = :LOGIN.PASS;
set_item_property('LOGIN.SHOW_MENU', visible, property_true);
set_item_property('LOGIN.SHOW_MENU', enabled, property_true);
Exception
When no_data_found Then
if :LOGIN.TRIES<3 then
message ('Invalid password....try again');
:LOGIN.TRIES := :LOGIN.TRIES+1;
:LOGIN.USER_NAME := null;
:LOGIN.PASS := null;
Go_Item( 'LOGIN.USER_NAME' ) ;
else
message ('Exceeded Number of tries..press exit button');
set_item_property('LOGIN.EXIT', visible, property_true);
set_item_property('LOGIN.EXIT', enabled, property_true);
end if;
end;
end;Francois -
Access class variables on new operator
Hi
I've created a class with a few public final int's
public class myClass(){
public final int SHOW_MENU = 1;
public final int SHOW_STATUSBAR = 2;
public myClass(int Flags){
now when I create this class I want to specify the flags by there logical names e.g SHOW_MENU,SHOW_STATUSBAR... like this
In a frame....
add(new myClass(myClass.SHOW_MENU)) ;Flags will be set to 1
The problem is that one cannot refere to the public variable SHOW_MENU until an actual instance of that class was created.
I'm sure there must be a way to do this.
Thanks
Carel"The problem is that one cannot refere to the public variable "
Yes boy you try to acces variable of class before you create it.
You are trying to get a constant.
pass constant to constructor.
call constructor
alocate memory
initialize fields.... there should be initialised your "constant?"
create object
return refference of this object
See If youd like to call a constant it should be somewhere. In a file in a different class or in the program. -
PyGtk/Python 2.0 png transparency help
I've googled and tried to solve this myself for the past few hours to no avail, so i'm hoping someone will be able to help. I installed gmail-notify and decided i wanted to make the popup transparent, so i started looking into the .py file. Even though i'm learning C, and some Assembly, i just can't fully understand python and the gtk library and the frustration is starting to get me. So basically what i'm trying to achieve is to make the image that pops up (background.png) transparent. I'm running stand-alone Openbox, with Cairo. And iv'e made the alpha layers and all that too in the png image. Any help would be greatly appreciated.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Uploaded by juan_grande 2005/02/24 18:38 UTC
import pygtk
pygtk.require('2.0')
import gtk
import time
import os
import pytrayicon
import sys
import warnings
import ConfigParser
import xmllangs
import GmailConfig
import GmailPopupMenu
import gmailatom
sys.path[0] = "/usr/share/gmail-notify"
BKG_PATH=sys.path[0]+"/background.png"
ICON_PATH=sys.path[0]+"/icon.png"
ICON2_PATH=sys.path[0]+"/icon2.png"
def removetags(text):
raw=text.split("<b>")
raw2=raw[1].split("</b>")
final=raw2[0]
return final
def shortenstring(text,characters):
if text == None: text = ""
mainstr=""
length=0
splitstr=text.split(" ")
for word in splitstr:
length=length+len(word)
if len(word)>characters:
if mainstr=="":
mainstr=word[0:characters]
break
else: break
mainstr=mainstr+word+" "
if length>characters: break
return mainstr.strip()
class GmailNotify:
configWindow = None
options = None
def __init__(self):
self.init=0
print "Gmail Notifier v1.6.1b ("+time.strftime("%Y/%m/%d %H:%M:%S", time.localtime())+")"
print "----------"
# Configuration window
self.configWindow = GmailConfig.GmailConfigWindow( )
# Reference to global options
self.options = self.configWindow.options
# Check if there is a user and password, if not, load config window
while ( self.options["gmailusername"] == None or self.options["gmailpassword"] == None ):
self.configWindow.show()
# Load selected language
self.lang = self.configWindow.get_lang()
print "selected language: "+self.lang.get_name()
# Creates the main window
self.window = gtk.Window(gtk.WINDOW_POPUP)
self.window.set_title(self.lang.get_string(21))
self.window.set_resizable(1)
self.window.set_decorated(0)
self.window.set_keep_above(1)
self.window.stick()
self.window.hide()
# Define some flags
self.senddown=0
self.popup=0
self.newmessages=0
self.mailcheck=0
self.hasshownerror=0
self.hassettimer=0
self.dont_connect=0
self.unreadmsgcount=0
# Define the timers
self.maintimer=None
self.popuptimer=0
self.waittimer=0
# Create the tray icon object
self.tray = pytrayicon.TrayIcon(self.lang.get_string(21));
self.eventbox = gtk.EventBox()
self.tray.add(self.eventbox)
self.eventbox.connect("button_press_event", self.tray_icon_clicked)
# Tray icon drag&drop options
self.eventbox.drag_dest_set(
gtk.DEST_DEFAULT_ALL,
[('_NETSCAPE_URL', 0, 0),('text/uri-list ', 0, 1),('x-url/http', 0, 2)],
gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
# Create the tooltip for the tray icon
self._tooltip = gtk.Tooltips()
# Set the image for the tray icon
self.imageicon = gtk.Image()
pixbuf = gtk.gdk.pixbuf_new_from_file( ICON_PATH )
scaled_buf = pixbuf.scale_simple(24,24,gtk.gdk.INTERP_BILINEAR)
self.imageicon.set_from_pixbuf(scaled_buf)
self.eventbox.add(self.imageicon)
# Show the tray icon
self.tray.show_all()
# Create the popup menu
self.popup_menu = GmailPopupMenu.GmailPopupMenu( self)
# Create the popup
self.fixed=gtk.Fixed()
self.window.add(self.fixed)
self.fixed.show()
self.fixed.set_size_request(0,0)
# Set popup's background image
self.image=gtk.Image()
self.image.set_from_file( BKG_PATH )
self.image.show()
self.fixed.put(self.image,0,0)
# Set popup's label
self.label=gtk.Label()
self.label.set_line_wrap(1)
self.label.set_size_request(170,140)
self.default_label = "<span size='large' ><i><u>"+self.lang.get_string(21)+"</u></i></span>\n\n\n"+self.lang.get_string(20)
self.label.set_markup( self.default_label)
# Show popup
self.label.show()
# Create popup's event box
self.event_box = gtk.EventBox()
self.event_box.set_visible_window(0)
self.event_box.show()
self.event_box.add(self.label)
self.event_box.set_size_request(180,125)
self.event_box.set_events(gtk.gdk.BUTTON_PRESS_MASK)
self.event_box.connect("button_press_event", self.event_box_clicked)
# Setup popup's event box
self.fixed.put(self.event_box,6,25)
self.event_box.realize()
self.event_box.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND1))
# Resize and move popup's event box
self.window.resize(180,1)
self.width, self.height = self.window.get_size()
self.height+=self.options['voffset']
self.width+=self.options['hoffset']
self.window.move(gtk.gdk.screen_width() - self.width, gtk.gdk.screen_height() - self.height)
self.init=1
while gtk.events_pending():
gtk.main_iteration(gtk.TRUE)
# Attemp connection for first time
if self.connect()==1:
# Check mail for first time
self.mail_check()
self.maintimer=gtk.timeout_add(self.options['checkinterval'],self.mail_check)
def connect(self):
# If connecting, cancel connection
if self.dont_connect==1:
print "connection attemp suspended"
return 0
self.dont_connect=1
print "connecting..."
self._tooltip.set_tip(self.tray,self.lang.get_string(13))
while gtk.events_pending():
gtk.main_iteration( gtk.TRUE)
# Attemp connection
try:
self.connection=gmailatom.GmailAtom(self.options['gmailusername'],self.options['gmailpassword'])
self.connection.refreshInfo()
print "connection successful... continuing"
self._tooltip.set_tip(self.tray,self.lang.get_string(14))
self.dont_connect=0
return 1
except:
print "login failed, will retry"
self._tooltip.set_tip(self.tray,self.lang.get_string(15))
self.default_label = "<span size='large' ><u><i>"+self.lang.get_string(15)+"</i></u></span>\n\n"+self.lang.get_string(16)
self.label.set_markup(self.default_label)
self.show_popup()
self.dont_connect=0
return 0
def mail_check(self, event=None):
# If checking, cancel mail check
if self.mailcheck==1:
print "self.mailcheck=1"
return gtk.TRUE
# If popup is up, destroy it
if self.popup==1:
self.destroy_popup()
self.mailcheck=1
print "----------"
print "checking for new mail ("+time.strftime("%Y/%m/%d %H:%M:%S", time.localtime())+")"
while gtk.events_pending():
gtk.main_iteration( gtk.TRUE)
# Get new messages count
attrs = self.has_new_messages()
# If mail check was unsuccessful
if attrs[0]==-1:
self.mailcheck=0
return gtk.TRUE
# Update tray icon
self.eventbox.remove(self.imageicon)
self.imageicon = gtk.Image()
if attrs[1]>0:
print str(attrs[1])+" new messages"
sender = attrs[2]
subject= attrs[3]
snippet= attrs[4]
if len(snippet)>0:
self.default_label="<span size='large' ><u><i>"+self.lang.get_string(17)+sender[0:24]+"</i></u></span>\n"+shortenstring(subject,20)+"\n\n"+snippet+"..."
else:
self.default_label="<span size='large' ><u><i>"+self.lang.get_string(17)+sender[0:24]+"</i></u></span>\n"+shortenstring(subject,20)+"\n\n"+snippet+"..."
self.show_popup()
if attrs[0]>0:
print str(attrs[0])+" unread messages"
s = ' '
if attrs[0]>1: s=self.lang.get_string(35)+" "
self._tooltip.set_tip(self.tray,(self.lang.get_string(19))%{'u':attrs[0],'s':s})
pixbuf = gtk.gdk.pixbuf_new_from_file( ICON2_PATH )
else:
print "no new messages"
self.default_label="<span size='large' ><i><u>"+self.lang.get_string(21)+"</u></i></span>\n\n\n"+self.lang.get_string(18)
self._tooltip.set_tip(self.tray,self.lang.get_string(18))
pixbuf = gtk.gdk.pixbuf_new_from_file( ICON_PATH )
self.label.set_markup(self.default_label)
scaled_buf = pixbuf.scale_simple(24,24,gtk.gdk.INTERP_BILINEAR)
self.imageicon.set_from_pixbuf(scaled_buf)
self.eventbox.add(self.imageicon)
self.tray.show_all()
self.unreadmsgcount=attrs[0]
self.mailcheck=0
return gtk.TRUE
def has_new_messages( self):
unreadmsgcount=0
# Get total messages in inbox
try:
self.connection.refreshInfo()
unreadmsgcount=self.connection.getUnreadMsgCount()
except:
# If an error ocurred, cancel mail check
print "getUnreadMsgCount() failed, will try again soon"
return (-1,)
sender=''
subject=''
snippet=''
finalsnippet=''
if unreadmsgcount>0:
# Get latest message data
sender = self.connection.getMsgAuthorName(0)
subject = self.connection.getMsgTitle(0)
snippet = self.connection.getMsgSummary(0)
if len(sender)>12:
finalsnippet=shortenstring(snippet,20)
else:
finalsnippet=shortenstring(snippet,40)
# Really new messages? Or just repeating...
newmsgcount=unreadmsgcount-self.unreadmsgcount
self.unreadmsgcount=unreadmsgcount
if unreadmsgcount>0:
return (unreadmsgcount, newmsgcount, sender, subject, finalsnippet)
else:
return (unreadmsgcount,0, sender, subject, finalsnippet)
def show_popup(self):
# If popup is up, destroy it
if self.popup==1:
self.destroy_popup()
# Generate popup
print "generating popup"
self.popuptimer = gtk.timeout_add(self.options['animationdelay'],self.popup_proc)
self.window.show()
return
def destroy_popup(self):
print "destroying popup"
if self.popuptimer>0:gtk.timeout_remove(self.popuptimer)
if self.waittimer>0: gtk.timeout_remove(self.waittimer)
self.senddown=0
self.hassettimer=0
self.window.hide()
self.window.resize(180,1)
self.window.move(gtk.gdk.screen_width() - self.width, gtk.gdk.screen_height() - self.height)
return
def popup_proc(self):
# Set popup status flag
if self.popup==0:
self.popup=1
currentsize=self.window.get_size()
currentposition=self.window.get_position()
positiony=currentposition[1]
sizey=currentsize[1]
if self.senddown==1:
if sizey<2:
# If popup is down
self.senddown=0
self.window.hide()
self.window.resize(180,1)
self.window.move(gtk.gdk.screen_width() - self.width, gtk.gdk.screen_height() - self.height)
self.popup=0
return gtk.FALSE
else:
# Move it down
self.window.resize(180,sizey-2)
self.window.move(gtk.gdk.screen_width() - self.width,positiony+2)
else:
if sizey<140:
# Move it up
self.window.resize(180,sizey+2)
self.window.move(gtk.gdk.screen_width() - self.width,positiony-2)
else:
# If popup is up, run wait timer
sizex=currentsize[0]
self.popup=1
if self.hassettimer==0:
self.waittimer = gtk.timeout_add(self.options['popuptimespan'],self.wait)
self.hassettimer=1
return gtk.TRUE
def wait(self):
self.senddown=1
self.hassettimer=0
return gtk.FALSE
def tray_icon_clicked(self,signal,event):
if event.button==3:
self.popup_menu.show_menu(event)
else:
self.label.set_markup(self.default_label)
self.show_popup()
def event_box_clicked(self,signal,event):
if event.button==1:
self.gotourl()
def exit(self, event):
dialog = gtk.MessageDialog( None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, self.lang.get_string(5))
dialog.width, dialog.height = dialog.get_size()
dialog.move( gtk.gdk.screen_width()/2-dialog.width/2, gtk.gdk.screen_height()/2-dialog.height/2)
ret = dialog.run()
if( ret==gtk.RESPONSE_YES):
gtk.main_quit(0)
dialog.destroy()
def gotourl( self, wg=None):
print "----------"
print "launching browser "+self.options['browserpath']+" [url]http://gmail.google.com[/url]"
os.system(self.options['browserpath']+" [url]http://gmail.google.com[/url] &")
def show_quota_info( self, event):
print "Not available"
#if self.popup==1:self.destroy_popup()
#print "----------"
#print "retrieving quota info"
#while gtk.events_pending()!=0:
# gtk.main_iteration(gtk.TRUE)
#try:
# usage=self.connection.getQuotaInfo()
#except:
# if self.connect()==0:
# return
# else:
# usage=self.connection.getQuotaInfo()
#self.label.set_markup("<span size='large' ><u><i>"+self.lang.get_string(6)+"</i></u></span>\n\n"+self.lang.get_string(24)%{'u':usage[0],'t':usage[1],'p':usage[2]})
#self.show_popup()
def update_config(self, event=None):
# Kill all timers
if self.popup==1:self.destroy_popup()
if self.init==1:gtk.timeout_remove(self.maintimer)
# Run the configuration dialog
self.configWindow.show()
# Update timeout
self.maintimer = gtk.timeout_add(self.options["checkinterval"], self.mail_check )
# Update user/pass
self.connection=gmailatom.GmailAtom(self.options["gmailusername"],self.options["gmailpassword"])
self.connect()
self.mail_check()
# Update popup location
self.window.resize(180,1)
self.width, self.height = self.window.get_size()
self.height +=self.options["voffset"]
self.width +=self.options["hoffset"]
self.window.move(gtk.gdk.screen_width() - self.width, gtk.gdk.screen_height() - self.height)
# Update language
self.lang=self.configWindow.get_lang()
# Update popup menu
self.popup_menu = GmailPopupMenu.GmailPopupMenu(self)
return
def main(self):
gtk.main()
if __name__ == "__main__":
warnings.filterwarnings( action="ignore", category=DeprecationWarning)
gmailnotifier = GmailNotify()
gmailnotifier.main()
Cheers!Anyone?
-
SteepANDCheap Notification Tool
Hi folks. I don't know if any of you follow Steep And Cheap (SAC), but I'm a climber and a runner and I like paying very little for things I don't really need, so I do. All of their notification tools are slow or windows-only, so I wrote my own.
No, I don't work for them.
sac.py
#!/usr/bin/python
SAC Notification Tool v0.1
(c) 2007 Michael Seiler
import urllib, htmllib, formatter
from pynotify import *
import time
class MyParser(htmllib.HTMLParser):
MyParser
Parse incoming SAC data into a product name and price details
def start_div(self, attrs):
if len(attrs) > 0:
for attr in attrs:
if attr[0] == 'id':
if attr[1] == 'price':
self.price_flag = 1
elif attr[1] == 'percent_off':
self.price_flag = 1
elif attr[1] == 'product':
self.product_flag = 1
def end_div(self):
self.price_flag = 0
self.product_flag = 0
def start_h2(self, attrs):
if self.product_flag:
self.product_title_flag = 1
def end_h2(self):
self.product_title_flag = 0
def handle_data(self, text):
if self.price_flag:
self.pricing.append(text)
elif self.product_title_flag:
self.product = text
def clear_buffers(self):
self.pricing = []
self.product = ""
def __init__(self):
null_format = formatter.NullFormatter()
htmllib.HTMLParser.__init__(self, null_format)
self.pricing = []
self.product = ""
self.price_flag = 0
self.product_flag = 0
self.product_title_flag = 0
def notify(title, message):
"""Show notification"""
init('sac.py')
a = Notification(title, message)
a.set_urgency(URGENCY_LOW)
a.set_timeout(EXPIRES_DEFAULT)
a.show()
if __name__ == '__main__':
old_product = ""
p = MyParser()
while True:
data = urllib.urlopen('http://www.steepandcheap.com').read()
p.feed(data)
p.close()
new_product = p.product
new_pricing = " - ".join(p.pricing)
if new_product != old_product:
if new_product:
notify(new_product, new_pricing)
old_product = new_product
p.clear_buffers()
time.sleep(15)
This requires python-notify, which is in community. And python, obviously.
It checks SAC for updates every 15 seconds and pops up (using libnotify) a little window with the item and the pricing details (Price - Percent Off) if it finds something new.
To run, just run sac.py and forget about it.
If for some reason you want to check slower (or, better yet, check faster), change time.sleep(15) to time.sleep(SECONDS), where SECONDS is how long you want it to wait. The windows desktop tool checks every 30 seconds, for reference.
Hope there's someone out there that can use this!
Last edited by buttons (2007-12-08 22:39:32)Why yes I am necroing this thread.
I messed with the script and made it work for whiskeymilitia.com...since I'm not all that into hiking and climbing gear.
I also changed the delay to 120 secs (2mins) because every 15 secs seemed a bit excessive..the deals only change every 20mins or so.
Feeling a bit paranoid and you might miss a deal? Just change the CHECK_DELAY field back to 15 if you want.
I also have it set to use Chromium for the "Buy now!" button. If you want to change it to something else just change the BROWSER field.
Im not claiming any credit here for this, all did was setup a feedburner for it and changed literally 4 or 5 things in the script.
#!/usr/bin/python
MhiskeyMilitia RSS Notification Tool v0.2
(c) 2008 Michael Seiler and Eric Larson
import urllib
import Image, cStringIO
from xml.dom import minidom
from pynotify import *
import gtk, gobject
import subprocess
#Global Constants
TIMEOUT = EXPIRES_DEFAULT #Time in milliseconds for the popup to stick around
#Use EXPIRES_DEFAULT for the default or EXPIRE_NEVER for forever
WEBSITE = 'http://www.whiskeymilitia.com/' #WM Website
CHECK_DELAY = 120 #Time in seconds between website checks
BROWSER = '/usr/lib/chromium-browser/chromium-browser' #No symlinks!
FEEDADDRESS = 'http://feeds.feedburner.com/whiskeymilitia/rtzq' # WM RSS Feed
ICONURL = 'http://images.whiskeymilitia.com/images/icon/wm.ico' # WM statusbar icon URL
SHOW_NOTIFICATION_ICON = True # Show WM icon in notification area?
RECHECK_ON_CLICK = False # Check the WM deal every time the notifier is activated by clicking the icon?
def url2pixbuf(imgurl):
img_feed = None
try:
img_feed = urllib.urlopen(imgurl).read()
except:
img_feed = None
if img_feed:
im = Image.open(cStringIO.StringIO(img_feed)).convert("RGB")
return gtk.gdk.pixbuf_new_from_data(im.tostring(),gtk.gdk.COLORSPACE_RGB,False,8,im.size[0],im.size[1],3*im.size[0])
else:
return None
class MyNotify(object):
MyNotify
Create and maintain the notification window and corresponding action methods
USAGE: n = MyNotify()
n.notify(title, message)
def notify(self, title, message, imgPixbuf):
"""Show notification with a buy button and image"""
self.notification.update(title, message)
if imgPixbuf:
self.notification.set_icon_from_pixbuf(imgPixbuf)
self.notification.show()
self.isvisible = True
def icon_clicked(icon,event,self):
if self.isvisible:
self.notification.close()
else:
if RECHECK_ON_CLICK and not self.checkingnow:
self.site_poll_timeout()
self.notification.show()
self.isvisible = True
def show_menu(self, icon, button, time):
self.menu.popup(None, None, gtk.status_icon_position_menu, button, time, icon)
def quit_clicked(self, menuItem):
if self.isvisible:
self.notification.close()
gtk.main_quit()
def open_site(self, n, action):
"""Called if the user clicks the buy button"""
subprocess.Popen([BROWSER, WEBSITE])
def destroy(self, n, action=None):
"""Called whenever the window disappears"""
self.isvisible = False
def __init__(self):
init('WMrss.py')
self.notification = Notification("Product", "Pricing", gtk.STOCK_DIALOG_WARNING)
self.notification.set_urgency(URGENCY_LOW)
self.notification.set_timeout(TIMEOUT)
self.notification.connect('closed', self.destroy)
self.notification.add_action('buy', 'Buy this item', self.open_site) #User clicks button
class WM_notifier(MyNotify):
WM_notifier
Handle timing, notification, and gtk interaction
USAGE: s = WM_notifier()
s.main()
Creates a timeout that downloads information from WM every CHECK_DELAY seconds,
then pops up a notification using pynotify if it finds a different product.
def read_data(self):
"""Read data from the WM website, then parse it"""
self.checkingnow = True
self.new_product = ""
self.description = ""
self.imgLocation = ""
self.priceCurrent = ""
self.priceRegular = ""
self.imgPixbuf = None
try:
self.file_feed = urllib.urlopen(FEEDADDRESS).read()
except:
#No interweb connection? WM down?
self.file_feed = None
if self.file_feed:
self.file_xml = minidom.parseString(self.file_feed)
self.item_node = self.file_xml.getElementsByTagName("item")
for childNode in self.item_node[0].childNodes:
if childNode.nodeType == childNode.ELEMENT_NODE:
if childNode.tagName == 'title':
self.new_product = childNode.firstChild.data
if childNode.tagName == 'odat:listDescription':
self.description = childNode.firstChild.data
if childNode.tagName == 'odat:priceCurrent':
self.priceCurrent = childNode.firstChild.data
if childNode.tagName == 'odat:priceRegular':
self.priceRegular = childNode.firstChild.data
if childNode.tagName == 'odat:tinyImage':
self.imgLocation = childNode.firstChild.data
self.imgPixbuf = url2pixbuf(self.imgLocation)
self.checkingnow = False
def site_poll_timeout(self):
"""Timeout called every CHECK_DELAY secs, which calls read_data, then notify if the item changed"""
self.read_data()
if self.file_feed:
if self.new_product != self.old_product and not self.new_product in self.seen_products:
if self.new_product:
percOff = '%d' % round(100.0*(float(self.priceRegular) - float(self.priceCurrent))/float(self.priceRegular))
descriptionString = "\n<b>Price: $" + self.priceCurrent + " (" + percOff + "% off!)</b>\nRegularly: $" + self.priceRegular + "\n\n" + self.description
self.notify(self.new_product, descriptionString, self.imgPixbuf)
self.seen_products.append(self.new_product)
self.old_product = self.new_product
return True
def main(self):
"""Create the timeout object and let the program sit in gtk.main()"""
self.site_poller = gobject.timeout_add(self.seconds_to_check, self.site_poll_timeout)
if SHOW_NOTIFICATION_ICON:
self.icon = gtk.StatusIcon()
iconBuf = url2pixbuf(ICONURL)
if iconBuf:
self.icon.set_from_pixbuf(iconBuf)
else:
self.icon.set_from_stock(gtk.STOCK_DIALOG_ERROR)
self.menu = gtk.Menu()
quit = gtk.MenuItem("Quit")
quit.connect("activate", self.quit_clicked)
quit.show()
self.menu.append(quit)
self.icon.connect("activate", self.icon_clicked, self)
self.icon.connect("popup-menu", self.show_menu)
gtk.main()
def __init__(self):
MyNotify.__init__(self)
self.old_product = ""
self.new_product = ""
self.priceCurrent = ""
self.priceRegular = ""
self.imgPixbuf = None
self.isvisible = False
self.seen_products = list()
self.seconds_to_check = CHECK_DELAY * 1000
self.checkingnow = False
self.site_poll_timeout()
if __name__ == '__main__':
s = WM_notifier()
s.main()
Proof?
<.<
Dont judge my wallpaper.
Last edited by whaevr (2010-02-15 22:20:27) -
Create Roles to allow users to see only what they have to see
Hi everyone,
I created a Menu using Forms 6i and I would like to know the steps to create a role and then assign those roles to my menu so users can only see the programs they use and not what the administrators are going to be using like some options under one of my menu called maintenance.So you mean that I have to open Module Roles under Menu Security and write a name for each role on that small window that appear? For example I want a role to be called SHOW_MENU then I type that name on that window and that's it?No, thats just the definition that this role is relevant for the menu. In the next step, you have to assign that role to every menu-item which should be accessible with the role.
After that do I need a special command on Oracle to assign the user that role and tell the database that I want that user just to see that menu item?Do don't tell the database anything about the menu, the database doesn't even know what a menu is. You assign the role to a database user, and then forms checks which roles are assigned to the connected user and with that information checks, which of the menuitems should be shown to the user.
The command to grant a role to a dbuser is
GRANT <ROLENAME> TO <USERNAME>; -
What is JDapi and how is it useful in oracle forms 10g?
The Oracle upgrade processes use jdapi for removing obsolete keywords. So, for example, you could search all program units for:
show_menu;
and replace it with:
-- show_menu;
regards,
Steve -
hello friends at oralce.com !
I have a popmenu in forms6i by which I click in an item and then right click to invoke popup menu.
Can I invoke the menu on say 'mouse-dbl-click' on an item, or when I navigate to an item, for example.
nb* "SHOW_MENU" is for forms menus only. ( I think!).
Gracias'.
n.I don't think so. The right-mouse-button behaviour is actually the standard method for summoning pop-up menus on the Windows and Motif platforms; it's different for Macs. I suspect Oracle doesn't control this behaviour, it just lets the runtime enviornment handle the calls. So I doubt that there's anything we can do to change this.
Sorry, PAC
Maybe you are looking for
-
HP Photosmart Premium All-In-One driver software will not fully install
After downloading and installing the full version of the printer driver (both from on-line site AND from purchased driver CD), the software appears to download fine, but will not fully install. I have run Print and Scan Doctor and tried on-line supp
-
Apps not loading from iTunes to iPod Touch
I recently purchased two games. They show up in my iTunes purchases and apps, at one point they claimed to be downloading, but I cannot locate them on my iPod Touch. I'm leaving for vacation Friday and would like to get this figured out. Any help app
-
Did a fresh install of Lion left the computer on all day to install my previously purchased apps and a number of them have the 'installed' sign next to them but they are nowhere to be seen on my system. I've tried to re-download but can't because the
-
Hi All, I Have written a program to delimit the most recent record of PA0000 and creating a new record by giving the Personnel.no , action type and date in selection screen. It is delimiting and creating a new record in PA0000 perfectly. But if i see
-
Link error not finding Problem.obj
I have a project that uses Meaurement Studio in VC++. Everything was fine until I used MStudio wizard to add support for common objects. Project refused to compile and link because the compiler could not find some .h and .Lib files. I included the pa