slider

Making a Custom Widget in PyQt

In this article, I am going to make a custom widget using PyQt4. Here in this example, we will have have a main form containing a Button and a Widget List. On clicking the button, a progress bar and a label will be added to the Widget List.
So lets Start with the Example, In this example, we will have three files,
File 1. progress.py(containing the progress bar and a label)
File 2. main_ui.py(containing our main form having a Button and a Widget list)
File 3. main.py(We will import progress.py and main_ui.py here and write the main calls here)

File 1: progress.py
from PyQt4 import QtCore, QtGui

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_(QtGui.QWidget):
    def __init__(self, name, parent=None):
        super(QtGui.QWidget,self).__init__(parent)
        self.layoutWidget = QtGui.QWidget()
        self.layoutWidget.setGeometry(QtCore.QRect(0, 0, 611, 31))
        self.layoutWidget.setObjectName(_fromUtf8("layoutWidget"))
        self.gridLayout = QtGui.QGridLayout(self.layoutWidget)
        self.gridLayout.setMargin(0)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.label = QtGui.QLabel(self.layoutWidget)
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.progressBar = QtGui.QProgressBar(self.layoutWidget)
        self.progressBar.setProperty("value", 0)
        self.progressBar.setObjectName(_fromUtf8("progressBar"))
        self.gridLayout.addWidget(self.progressBar, 0, 1, 1, 1)
        self.timer = QtCore.QBasicTimer()
        self.step = 0
        self.timer.start(100,self)

        QtCore.QMetaObject.connectSlotsByName(self)
        self.label.setText(_translate("", name, None))

self.setLayout(self.gridLayout)
    def timerEvent(self, e):
if self.step>= 100:
self.timer.stop()
return
self.step = self.step + 1
self.progressBar.setValue(self.step)   
This file contains a label and a progress bar, this file will be called in the main.py along with an argument, that argument will be put into label as a string. Just for the sake of demonstration, we are adding incrementing the variable step starting from 0 to 100 and updating it on progress bar. In Case of a download manager, the current file size can be queried and the percentage downloaded can be displayed on the progress bar.
The UI was designed in Qt designer and converted to py using pyuic.

File2: main_ui.py
from PyQt4 import QtCore, QtGui

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(683, 400)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.listWidget = QtGui.QListWidget(self.centralwidget)
        self.listWidget.setGeometry(QtCore.QRect(50, 150, 591, 192))
        self.listWidget.setObjectName(_fromUtf8("listWidget"))
        self.pushButton = QtGui.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(50, 40, 81, 23))
        self.pushButton.setObjectName(_fromUtf8("pushButton"))
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 683, 21))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
        self.pushButton.setText(_translate("MainWindow", "Add Download", None))
This File has been designed in the Qt designer, Its a form containing a Button and List Widget. The UI file was converted using pyuic.

File3: main.py
import sys
from PyQt4 import QtCore, QtGui
from main_ui import Ui_MainWindow
import progress
import random

reload(progress)
class MyForm(QtGui.QMainWindow):
  def __init__(self, parent=None):
    QtGui.QWidget.__init__(self, parent)
    self.ui = Ui_MainWindow()
    self.ui.setupUi(self)
    self.ui.pushButton.clicked.connect(self.progress)

  def progress(self):
 item = QtGui.QListWidgetItem(self.ui.listWidget)
 item_widget = progress.Ui_("It works")
 item.setSizeHint(item_widget.sizeHint())
 self.ui.listWidget.addItem(item)
 self.ui.listWidget.setItemWidget(item,item_widget)

if __name__ == "__main__":
  app = QtGui.QApplication(sys.argv)
  myapp = MyForm()
  myapp.show()
  sys.exit(app.exec_())

In this file, we connect the onclick event of the Button to the progress function. The function progress creates a new instance of custom widget from progress.py  and adds the custom widget to the QListWidget.

Read More(Full Post)...

Extract Image Perfectly from Background using Photoshop Extract Tool

Extract Tool is a filter tool in Photoshop which is used to extract out an image from its background. But unfortunately it has been removed from Photoshop CS5 and CS4. It is present under filter menu in photoshop’s  previous versions. As the name suggests, this tool makes it very easier to extract an image out of its background. Especially the ‘furry’ part of the image. Its also a preferred tool to extract the image of a person as it can extract the hairs perfectly.
This tool can be manually installed in Photoshop CS5 and Photoshop CS4  by downloading the file from below given link and putting it into specified folder.
Follow the following steps:
1.    First Download the Extract Tool.
For Photoshop CS4, Download the rar file from:
http://dl.dropbox.com/u/3255460/photoshopextractfilter/CS4.rar
For Photoshop CS5, Download the zip file from:
http://dl.dropbox.com/u/3255460/photoshopextractfilter/CS5.rar
2.     Extract the downloaded file and navigate to ’32 Bit’ or ’64 Bit’ folder according to your system.
3.    Copy the file “Extractplus” to C:\Program Files\Adobe\Adobe Photoshop CS\Plug-ins\Filters

Restart the Photoshop and you will find the Extract tool in Filter menu.

Now how to use it.
1.    Open the Image in Photoshop
2.    Goto Filter menu and choose ‘Extract’.
3.    Choose the “Edge Highlighter Tool”,
4.    Now use it to mark the edges of the areas that are to be retained as shown above. Choose the marker size in a way such that the furry part and the background edge is covered in the width of marker. Markers of different sizes can be used at different places.
5.    Use the Fill tool to colour the areas to be retained.
6.    Click ‘OK’ to extract the image out of its background.br />

7.    Now this Image can be put into any new background.

Read More(Full Post)...

How to Remove Genuine Notification on Windows XP

Here is a trick on how to remove Genuine Notification from Microsoft. I have only tried this on XP. Just follow this procedures:

1. Lauch Windows Task Manager.
2. End wgatray.exe process in Task Manager.
3. Restart Windows XP in Safe Mode.
4. Delete WgaTray.exe from c:\Windows\System32.
5. Delete WgaTray.exe from c:\Windows\System32\dllcache.
6. Search computer for 'wga*.*' and delete everything like wganotify and wgatray
7. Lauch RegEdit.
8. Browse to the following location:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
    Windows NT\CurrentVersion\Winlogon\Notify
9. Delete the folder ‘WgaLogon’ and all its contents
10. Reboot Windows XP.

Done!!!

Read More(Full Post)...

Blogumus: 3D Spherical Flash Animated Cloud Tag for Blogger

"Blogumus" is an Flash based tag cloud widget which uses scripts converted from Roy Tanck's WP Cumulus plugin for Wordpress. Hover your mouse over the Flash object on the right side to see the animation begin. In this post, I'll explain how you can add Blogumus to your own Blogger layout with ease!
How to install Blogumus in your Blogger layout?
Installing Blogumus in your Blogger layout is surprisingly simple! You should only need to copy and paste a section of code to your Blogger template, though any tweaks for the style of display will require some manual editing. Here are the steps required to install Blogumus in your Blogger layout:
Go to Layout>Edit HTML in your Blogger dashboard, and search for the following line (or similar): Immediately after this line, paste the following section of code:
<b:section class='sidebar' id='sidebar' preferred='yes'>
Immediatly after this line, paste the following section of code:
<b:widget id='Label99' locked='false' title='Labels' type='Label'>
<b:includable id='main'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content'>
<script src='http://sites.google.com/site/bloggerustemplatus/code/swfobject.js' type='text/javascript'/>
<div id='flashcontent'>Blogumulus</div>
<script type='text/javascript'>
var so = new SWFObject(&quot;http://sites.google.com/site/bloggerustemplatus/code/tagcloud.swf&quot;, &quot;tagcloud&quot;, &quot;240&quot;, &quot;300&quot;, &quot;7&quot;, &quot;#ffffff&quot;);
// uncomment next line to enable transparency
//so.addParam(&quot;wmode&quot;, &quot;transparent&quot;);
so.addVariable(&quot;tcolor&quot;, &quot;0x333333&quot;);
so.addVariable(&quot;mode&quot;, &quot;tags&quot;);
so.addVariable(&quot;distr&quot;, &quot;true&quot;);
so.addVariable(&quot;tspeed&quot;, &quot;100&quot;);
so.addVariable(&quot;tagcloud&quot;, &quot;<tags><b:loop values='data:labels' var='label'><a expr:href='data:label.url' style='12'><data:label.name/></a></b:loop></tags>&quot;);
so.addParam(&quot;allowScriptAccess&quot;, &quot;always&quot;);
so.write(&quot;flashcontent&quot;);
</script>
<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>
Then preview your template. If installed correctly, you should see the tag cloud appear in your sidebar. Then you are free to save your template, edit the colors and dimensions as required, or move it to a different location. That's all!
In this default installation, Blogumus includes the following preset variables:
  • Width is set to 240px
  • Height is set to 300px;
  • Background color is white
  • Test color is grey
  • Font size is "12"
If you would prefer to make your widget wider, shorter, change the color scheme, etc, you will need to do this by editing various parts of the code. I'll go through these options in the order they appear in the widget code. 
In code, 
  • Change 240 to change width.
  • Change 300 to change height.
  • Change #ffffff to change background color.
  • Change 333333 to change text color from grey to any you want.
  • Change 12 to change text size..

Read More(Full Post)...

Fix External/Flash Drive Folders Changed to Shortcuts Virus


Some Viruses changes our files on our Flash Drive or External Hard Drive changed into Shortcuts. We can’t open the files from our Pen/Thumb drives. Many people are getting this Virus from their Work Place and Losing their Data. How do i get my files back so that I can view them? Most viruses delete the “Folder options” menu and “Task Manager” as well.
Solution to Fix External/Flash Drive Files Changed into Shortcuts :
The good side of these viruses is that they don’t delete the actual content. It was just hide in our Flash Drive. We can easily recover all the files.
Step 1: If you are affected by Shortcut Viruses, Do not format your Flash or External Drive. If you format you can’t Recover it.
Step 2: Check your Flash Drive’s Drive Letter ( Example : I: or K:)

Step 3: Click on “Start” –>Run–>type “cmd” and click on OK
Step 4: If your Flash Drive Letter is K: then Type the below command in your “cmd” and Press “Enter
attrib -h -r -s /s /d k: *.* 
(Check the screenshot ) Note : Replace the letter k: with your flash drive letter
NOTE: TYPE THE DRIVE LETTER IN LOWERCASE AND ALSO USE SPACES AT APPROPRIATE PLACES WHILE TYPING THE COMMAND IN COMMAND PROMPT.
Step 5 : Now your files will be visible. Make sure to keep the antivirus up-to-date to prevent viruses.

Read More(Full Post)...

Get Accidentally Deleted Posts Back

If you delete your blog by mistake, there are 100% chances of recovering it by using the blogger's Undelete this blog feature but unfortunately these is no option like Undelete this post. So how do we get the accidentally deleted posts back?
There are three ways, one of which depends on the cooperation of a helper plus a good memory or clever guesswork.

METHOD 1
This method is applicable if you are still working on the same computer where you had prepared the post (or had viewed the deleted post). Just press ctrl+H (Cmd+H on MAC OS) to open a sidebar listing the browser history. Go to the part where you were editing the post and continue to edit or publish the post (or copy-paste from the cached copy of the displayed post):
Alternative keyboard shortcut to call up the browser is shift+ctrl+H (shift+Cmd+H for MAC OS).
  
METHOD 2
This method is applicable if you had not closed the tab or window where you had been preparing the deleted post (or had viewed the deleted post). Just keep pressing the BACK button till you get back to the point where you were editing the post (or had viewed the post).

METHOD 3
Try to find a cached copy of the deleted post on the Web and restore the post from the cached copy. Type in
cache:URL
to try to find cached copies on the net.
Alternatively, you can just type in some relevant search terms, especially what you can remember from the post title, into the search box and search. If the search throws up a result, click the link cached (see screen shot below) to open the cached webpage and either reconstruct a fresh post with the content from that cached webpage.

METHOD 3
Another possibility is to try the Way Back Machine. This is a tool which archives the post of almost all the website. Enter your website's URL in the WAY BACK MACHINE and it will show the cached copy of the post it has archived from your website. If you are lucky enough you will find your deleted post as well. 
 

Read More(Full Post)...

Google Wallet is out now

NEW YORK: Google's Wallet is getting thicker, with the addition of Visa, American Express and Discover to the search company's payment system, which aims to make cellphones the credit cards of tomorrow.

MasterCard, the other major payment processor, is already part of the project. And Google released the Wallet application on Monday for one Sprint smartphone for users with MasterCards.

People with that phone will be able to "load" a Citibank MasterCard into the Wallet application on the phone, and pay by tapping the phone to wireless-capable payment terminals in stores instead of swiping a credit card. Visa, American Express and Discover cards are set to appear later. Visa plans to bring out its own, competing wallet application as well. 


What is Google Wallet? 
Google Wallet is a mobile payment system developed by Google that allows its users to store credit cards, loyalty cards, and gift cards among other things, as well as redeeming sales promotions on their mobile phone. Google Wallet uses near field communication to "make secure payments fast and convenient by simply tapping the phone on any PayPass-enabled terminal at checkout."
Google demonstrated the app at a press conference on May 26, 2011. The app was released on September 19, 2011. 

A locked wallet is a safer wallet
Google Wallet requires you to set up a Google Wallet PIN that must be entered before making a purchase. This PIN prevents unauthorized access and payments via Google Wallet. Android phones also feature a separate lock screen.
 
Secure technology
Google Wallet and MasterCard PayPass™ provide many layers of security.
Google Wallet stores your encrypted payment card credentials on a computer chip on your phone called the Secure Element. Think of the Secure Element as a separate computer, capable of running programs and storing data. The Secure Element is separate from your Android phone's memory. The chip is designed to only allow trusted programs on the Secure Element itself to access the payment credentials stored therein.
The secure encryption technology of MasterCard PayPass protects your payment card credentials as they are transferred from the phone to the contactless reader.
 
What to do if your phone is lost or stolen
Even though the Google Wallet PIN and Secure Element protect your payment card information, you should still call your issuing banks to cancel your cards.

CHECK OUT THE DEMO BELOW 



Read More(Full Post)...

Make an Invisible Folder in Windows

You can create an Invisible folder in Windows by naming it with a blank space and changing its icon to transparent.
 Follow these Steps:
  • Right click on desktop>New>Folder
  • Rename it as “ALT + 0160” (means enter the sequence '0160' with ALT key pressed)
  • You will notice that a blank space is used for naming the folder.
  • Now right click on folder>properties>Customize>change icon…
  • Choose a blank icon and click on OK.
  • Your invisible folder is ready to work. 
Customize it further to protect it further by changing it to hidden folder.
  • Right click on folder>properties>hidden
  • click on OK.

Read More(Full Post)...

Backup Data on Google using Google Takeout

Isn't it a good idea, having the backup of your data which you stored on Google with yourself as-well? Google’s Data Liberation Front team has launched a new data storage service called Google Takeout, which helps the users to create backups of data from all Google services like Buzz, Picasa along with Google contacts and Google+ circles. So this was the greatest way to backup all of your Google Data Easily.
The Google Takeout service allows you take backups of all your Google data and export it as zip or other open file formats. Users can choose a single backup for data from all supported Google services or one backup per service.

Its as simple as Google. Just go to GOOGLE TAKEOUT PAGE and select the service that you want to take backup or you can take the backup of whole Google Data there.
Check out the video below to learn more.



Read More(Full Post)...

Windows 8 Developer Preview ISO (64 & 32 Bit download)

Microsoft released a Windows 8 Developer Preview publicly, so that means you don’t need a developer’s license to get at it. Anyone can download the Windows 8 Developer Preview ISO 64 & 32 Bit and see what Windows 8 has. To try new Windows 8 on you PC you need need a PC with a 1GHz or faster processor (either 32- or 64-bit), 1GB of RAM (2GB for 64-bit), 16GB of hard disk space (20GB for 64-bit), DirectX 9 graphics with WDDM 1.0 or higher driver.
 
 DOWNLOAD HERE
1. Windows Developer Preview with developer tools English, 64-bit (x64)
2. Windows Developer Preview English, 64-bit (x64)
3. Windows Developer Preview English, 32-bit (x86)

The new Windows 8 OS comes with a new Metro UI, App Store and more new features. With the new release of Windows 8 there are new Windows 8 Keyboard Shotcuts are available. Below are the 18 official shortcut keys to access some of the features in Windows 8 operating system.

 Windows 8 Keyboard Shortcuts -
Windows Logo Key + Spacebar – Switch input language and keyboard layout
Windows Logo Key + Y – Temporarily peek at the desktop
Windows Logo Key + O – Locks device orientation
Windows Logo Key + V – Cycles through toasts
Windows Logo Key + Shift + V – Cycles through toasts in reverse order
Windows Logo Key + Enter – Launches Narrator
Windows Logo Key + PgUp – Moves tiles to the left
Windows Logo Key + PgDown – Moves tiles to the right
Windows Logo Key + Shift + . – Moves the split to the left
Windows Logo Key + . – Moves the split to the right
Windows Logo Key + F – Opens File Search App
Windows Logo Key + C – Opens Charms Bar
Windows Logo Key + I – Opens Settings charm
Windows Logo Key + K – Opens Connect charm
Windows Logo Key + H – Opens Share charm
Windows Logo Key + Q – Opens Search pane
Windows Logo Key + W – Opens Settings Search app
Windows Logo Key + Z – Opens App Bar

You can also access the Windows 8 Developer Preview guide. This downloadable guide shows you new features for developers, consumers and businesses.
Download PDF       Download XPS

Read More(Full Post)...

Related Posts Plugin for WordPress, Blogger...
 
Download & Learning © 2011 | Contact